UTIL Remove: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (linked the german translation)
No edit summary
 
(5 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{otherlang2
{{LanguageBar}}
|de=UTIL_Remove:de
UTIL_Remove is a [[UTIL]] provided in the Source SDK code for removing ("[[kill]]ing") objects. UTIL_Remove marks an object for deletion ''on the next frame'', instead of the current one. Removing objects on the current frame can cause null pointers '''which will cause the game to crash''', so UTIL_Remove is included to prevent this.
}}
UTIL_Remove is a [[UTIL]] provided in the Source code for removing objects. UTIL_Remove marks an object for deletion ''on the next frame'', instead of the current one. Removing objects on the current frame can cause null pointers '''which will cause the game to crash''', so UTIL_Remove is included to prevent this.


==Usage==
<source lang=cpp>void UTIL_Remove( IServerNetworkable *oldObj );</source>


== Usage ==
==Examples==
<source lang=cpp>void UTIL_Remove( IServerNetworkable *oldObj )</source>
 
 
== Examples ==


<source lang=cpp>
<source lang=cpp>
Line 24: Line 20:
</source>
</source>


== See Also ==
==See also==
* [https://github.com/ValveSoftware/source-sdk-2013/blob/a62efecf624923d3bacc67b8ee4b7f8a9855abfd/src/game/server/util.cpp#L453 Definition]
* [[UTIL_RemoveImmediate]]
* [[UTIL_RemoveImmediate]]
* [[UTIL_EnableRemoveImmediate]]
* [[UTIL_EnableRemoveImmediate]]

Latest revision as of 16:41, 17 March 2025

English (en)Deutsch (de)Português do Brasil (pt-br)Translate (Translate)

UTIL_Remove is a UTIL provided in the Source SDK code for removing ("killing") objects. UTIL_Remove marks an object for deletion on the next frame, instead of the current one. Removing objects on the current frame can cause null pointers which will cause the game to crash, so UTIL_Remove is included to prevent this.

Usage

void UTIL_Remove( IServerNetworkable *oldObj );

Examples

UTIL_Remove( this );
CBaseFire *pEffect = m_hEffect;
if ( pEffect != NULL )
{
	UTIL_Remove( pEffect );
        m_hEffect = NULL;
}

See also