MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Spawn

Method Spawn

Source/Engine/Particles/ParticleEmitter.cpp:46–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46ParticleEffect* ParticleEmitter::Spawn(Actor* parent, const Transform& transform, float duration, bool autoDestroy)
47{
48 PROFILE_MEM(Particles);
49 CHECK_RETURN(!WaitForLoaded(), nullptr);
50 auto system = Content::CreateVirtualAsset<ParticleSystem>();
51 CHECK_RETURN(system, nullptr);
52 system->Init(this, duration < MAX_float ? duration : 3600.0f);
53
54 auto effect = New<ParticleEffect>();
55 effect->SetTransform(transform);
56 effect->ParticleSystem = system;
57
58 Level::SpawnActor(effect, parent);
59
60 if (autoDestroy && duration < MAX_float)
61 effect->DeleteObject(duration, true);
62
63 return effect;
64}
65
66void ParticleEmitter::WaitForAsset(Asset* asset)
67{

Callers

nothing calls this directly

Calls 3

SetTransformMethod · 0.80
DeleteObjectMethod · 0.80
InitMethod · 0.45

Tested by

no test coverage detected