Duplicate Script on Hit VFX

At about 7:27 Rick adds the Self Destruct script to the Hit VFX prefab, but since we duplicated this from the already existent Enemy Explosion VFX, it already had the Self Destruct script.

This generated a few questions:

  • Will having the script in there twice cause issues?
  • In general, can having a duplicate script on a Game Object cause trouble? How does Unity decide which one to run, or does it run both?

Thanks for any light you can shine on my curious questions!

You can do it. Unity will execute both scripts.

It often causes issues as it’s not often something you indent to do, so you usually end up with duplicate effects happening and you need to debug it.

Privacy & Terms