Skip to main content
Version: latest - a1.172.0 ⚖️

✨ Particle

Class to spawn Particle Systems used to create effects in the world

Client & Server🔁Not Distributable🧑‍💻API Source
👪Inheritance
This class shares methods and events from Base Entity, Base Actor.

tip

Both Cascade and Niagara Particle Systems are supported!

🎒 Examples​

Server/Index.lua
local my_particle = Particle(
Vector(-200, 100, 100),
Rotator(0, 0, 0),
"nanos-world::P_Explosion",
true, -- Auto Destroy?
true -- Auto Activate?
)

🛠 Constructors​

Default Constructor​

No description provided

local my_particle = Particle(location, rotation, asset, auto_destroy?, auto_activate?, spawn_mode?)
Parameters
NameTypeDescription
locationVectorWorld location to spawn at
rotationRotatorWorld rotation to spawn with
assetParticle ReferenceThe asset to use
auto_destroy?booleanWhether to destroy it after it finishes playing Default true
auto_activate?booleanWhether to start playing immediately Default true
spawn_mode?SpawnModePass SpawnMode.AfterConstructor or SpawnMode.Manual to avoid immediately sending the entity to clients and improve performance when you want to configure it by setting several configs. Must call FinishSpawn() after all Default SpawnMode.Immediate
Note

auto_destroy means the Entity will be immediately destroyed after spawned, losing references to the Particle System spawned in-game. So if the Particle System itself loops indefinitely, it will keep playing until the Player reconnects.

🗿 Static Functions​

This class doesn't have own static functions.

Inherited static functions

🦠 Functions​

ActivateActivates the Emitter
DeactivateDeactivate the Emitter
IsActive: booleanReturns if this Particle is active
SetParameterBoolSets a boolean parameter in this Particle System
SetParameterColorSets a Color parameter in this Particle System
SetParameterFloatSets a float parameter in this Particle System
SetParameterIntSets an integer parameter in this Particle System
SetParameterMaterialSets a Material parameter in this Particle System
SetParameterMaterialFromCanvasSets a Material from a Canvas parameter in this Particle System
SetParameterMaterialFromTextureSets a Material from a Texture parameter in this Particle System
SetParameterMaterialFromWebUISets a Material from a Canvas parameter in this Particle System
SetParameterVectorSets a Vector parameter in this Particle System

ActivateOptimal​

Activates the Emitter

my_particle:Activate(should_reset?)
Parameters
NameTypeDescription
should_reset?booleanIf should reset Default false

See also Deactivate, IsActive.

DeactivateOptimal​

Deactivate the Emitter

my_particle:Deactivate()

See also Activate, IsActive.

IsActiveOptimal​

Returns if this Particle is active

local is_active = my_particle:IsActive()
Returns
TypeDescription
booleanWhether this Particle is active

See also Activate, Deactivate.

SetParameterBoolOptimal​

Sets a boolean parameter in this Particle System

my_particle:SetParameterBool(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valuebooleanThe boolean value

SetParameterColorOptimal​

Sets a Color parameter in this Particle System

my_particle:SetParameterColor(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valueColorThe Color value

SetParameterFloatOptimal​

Sets a float parameter in this Particle System

my_particle:SetParameterFloat(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valuefloatThe float value

SetParameterIntOptimal​

Sets an integer parameter in this Particle System

my_particle:SetParameterInt(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valueintegerThe int value

SetParameterMaterialSlow​

Sets a Material parameter in this Particle System

my_particle:SetParameterMaterial(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valueMaterial ReferenceThe Material to apply.

Note: the material needs to be configured to be "Used with Niagara" or "Used with Particles" in the material asset settings, otherwise it may not be applied correctly

SetParameterMaterialFromCanvasModerate​

Sets a Material from a Canvas parameter in this Particle System

This will create a Material and set this Canvas as it's parameter internally, then set the Material into the Particle parameter

my_particle:SetParameterMaterialFromCanvas(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valueCanvasThe Canvas value

SetParameterMaterialFromTextureSlow​

Sets a Material from a Texture parameter in this Particle System

This will create a Material and set this Texture as it's parameter internally, then set the Material into the Particle parameter

my_particle:SetParameterMaterialFromTexture(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valueImage PathThe Texture value

SetParameterMaterialFromWebUIModerate​

Sets a Material from a Canvas parameter in this Particle System

This will create a Material and set this WebUI as it's parameter internally, then set the Material into the Particle parameter

my_particle:SetParameterMaterialFromWebUI(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valueWebUIThe WebUI value

SetParameterVectorOptimal​

Sets a Vector parameter in this Particle System

my_particle:SetParameterVector(parameter, value)
Parameters
NameTypeDescription
parameterstringThe parameter name
valueVectorThe Vector value

🚀 Events​

This class doesn't have own events.