PrecacheParticleSystem: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Added todo about clarification)
No edit summary
Line 1: Line 1:
PrecacheMaterial is a function provided to Precache particle effects by string. It is generally used to precache specific particle systems rather than every system in a particle file.  
PrecacheParticleSystem is a function provided to precache particle effects by string. Make sure to specify the name of the actual particle effect and not the name of the .pcf file. All child systems in question will be precached as well.


{{todo|Clarify if this is the .pcf name or the particle name inside the .pcf!}}
== Usage ==
== Usage ==
<source lang=cpp>
<source lang=cpp>
Line 13: Line 12:
}
}
</source>
</source>


== Examples ==
== Examples ==

Revision as of 12:39, 14 April 2011

PrecacheParticleSystem is a function provided to precache particle effects by string. Make sure to specify the name of the actual particle effect and not the name of the .pcf file. All child systems in question will be precached as well.

Usage

//-----------------------------------------------------------------------------
// Precaches a particle system
//-----------------------------------------------------------------------------
void PrecacheParticleSystem( const char *pParticleSystemName )
{
	g_pStringTableParticleEffectNames->AddString( false, pParticleSystemName );
	g_pParticleSystemMgr->PrecacheParticleSystem( pParticleSystemName );
}

Examples

void CWeaponSMG1::Precache( void )
{
	PrecacheParticleSystem( "muzzle_smg1" );
}