Scripts, events and organization after redo

So after I am done with, say, the Cactus, I should end up with something like this:

Cactus
|—Body
-----|-Gun

The Animator with Controller should be on the Cactus object, in the Animation window what we would be animating to get the moving cactus would be the Sprite on the Body’s Sprite Renderer.

The Shooter and Attack Spawner scripts will be attached to the Cactus object, because we need the Attack event in the animation, and eventually the y-position for the spawn lane.

Correct?

Hi @TimeStreamError,

That’s right.

We could add the Animator wherever we want but it makes sense to have it on the root object so we do not have to guess where the component might be if we look for it.

Same rationale as above: We mainly keep the scripts on the parent so we have everything in one obvious place.

What we must do is to keep the animated object and the object moved via code separate. The rest is mainly a matter of preference and “good practice”.

Did this clear it up for you? :slight_smile:


See also:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms