79366405

Date: 2025-01-18 00:49:42
Score: 1
Natty:
Report link

Prefabs can have scripts same as regular objects. You can add a new script to the prefab by dragging and dropping it on the prefab in the unity editor, or selecting the prefab and using "add component" in the inspector window then adding a "new script".

to move the instantiated objects in a random direction, just add the translate into the Update() method of this new script. In a collider on trigger event (or similar) check if self is normal and the other is a virus, and if so, then instantiate a new virus, set its transform to that of the current object, save any other properties you want to save into the new virus, then destroy this.gameobject.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Dina