Basic movement confusion

Hello again, i want to make a basic movement of entity, when i enable the entity it have to move up from 0 to x position and after go back to 0 and destroy it. I know is a simple task but i got confused. I launch a script called spellEffect where the entity (the script is not attached to the entity) get cloned and enabled, for the movement i have to create a script inside the entity or i can handle it from spellEffect? I know is a stupid question, but i’m having an hard time figuring how to do that :sweat:

There are several ways of doing this. I generally prefer not to clone and destroy entities due to the garbage collection (watch more here: https://www.youtube.com/watch?v=RWmzxyMf2cE). Assuming you could have multiple spell effects going off at once, I would have a ‘pool’ of these spell effects that I could move/teleport to a position, enable, it would animate and disable itself.

This would mean that you have a ‘spellEffectManager’ that manages this pool and the spellEffect itself would have a script for the animation and when finished, it would disable itself. At this point, it would also fire an event back to the manager so it can be readded back to the pool.

1 Like

I see your point @yaustar i will work on that it would definitely be useful if going multiplayer. For now just made a basic animation…i will make it better and make better also the model that looks really bad. :stuck_out_tongue: but for test purposes is ok.