PKFxFX component V3
This is the FX component, it holds the name of the effect, the attributes and the controls to the effect.
![]() |
Description
- FX
- Holds the pathname to the pkfx file.
- The file can be dragged and dropped from the Project view.
- The file must be located in <project root>/Assets/StreamingAssets/PackFx/ (or a subdirectory) and have a .pkfx extension.
- Play On Start
- Set to true to start playing the effect when its Start() method is executed.
- Attributes
- If it has any, the effect's attributes will be displayed here. Their values are serialized with the assets so you can have prefabs or GameObjects in your scene saved with specific attribute values.
- See also : Animating Effects Attributes
- Samplers
- Like for the attributes, if the effect has any samplers, they will be displayed here.
- See also : Effect Attribute Samplers
- See also : Animating Effects Attribute Samplers
Public Methods
Alive
public bool Alive()
If individual effects killing is disabled AND the SpawnerID field is disabled in your effect, this will return false as soon as the effect is done spawning its particles.
If individual effects killing is enabled OR the SpawnerID field is enabled in your effect, it will return false as soon as all of the FX instance's particles are dead.
The component is considered safe to delete (along with its GameObject) when this returns false. Although, avoid polling this function every frame, as native function calls induce overhead.
- You should rather use PKFxFX component#Public Delegate
AttributesExist
public bool AttributesExist(PKFxManager.AttributeDesc desc)
Checks if an attribute exists for this effect.
Checks for both desc's type and name.
GetAttribute
public PKFxManager.Attribute GetAttribute(string name)
public PKFxManager.Attribute GetAttribute(string name, PKFxManager.BaseType type)
Returns the attribute named name (of type type if specified) if available.
Returns null otherwise.
See also : Effect Attributes Animation
GetSampler
public PKFxManager.Sampler GetSampler(string name)
public PKFxManager.Sampler GetSampler(string name, PKFxManager.ESamplerType type)
Returns the sampler named name (of type type if specified) if available.
Returns null otherwise.
See also : Effect Attribute Samplers Animation
KillEffect
public void KillEffect()
If individual effects' killing is enabled, instantly kills the effect and all its associated particles.
SetAttribute
public void SetAttribute(PKFxManager.Attribute attr)
Sets the PKFxFX instances' attribute described by attr.
SamplerExists
public bool SamplerExists(PKFxManager.SamplerDesc desc)
Checks if a sampler exists for this effect.
Checks for both desc's type and name.
SetSampler
public void SetSampler(PKFxManager.Sampler sampler)
Sets the PKFxFX instances' attribute described by sampler.
StartEffect
public void StartEffect()
Starts the effect.
StopEffect
public void StopEffect()
Stop the emission but continue to update the transform and attributes until the end of the effect.
TerminateEffect
public void TerminateEffect()
Stops the effect and the associated updates.
This will also trash the attributes so if all particles haven't died already when terminating the effect they will sample the default attributes instead of the actual values.
Formerly called StopEffect().
public void SetNameAndLoadAttributes(string fxName)
Coming soon
public void LoadAttributes(List<PKFxManager.AttributeDesc> FxAttributesDesc, bool flushAttributes)
Coming soon
public void UpdateAttributes(bool forceUpdate)
Coming soon
public void DeleteAttribute(PKFxManager.AttributeDesc desc)
Coming soon
public PKFxManager.Attribute GetAttributeFromDesc(PKFxManager.AttributeDesc desc)
Coming soon
Public Delegate
m_OnFxStopped
public delegate void OnFxStoppedDelegate(PKFxFX component); public OnFxStoppedDelegate m_OnFxStopped;
You can set this delegate to a function of your choice that will be called when the effect stops.
This will be called as soon as the "Alive()" method would return false.
/!\ This delegate isn't working in the compiled versions of the plugin, like the one shipped with the Packs available on the Asset Store (Discovery, Cartoon, Warfare).