- Home /
Question by
Tyler 2 · Nov 30, 2010 at 11:37 PM ·
childdeactivate
Destroying a child object?
Hello. After a condition happens, how can I deactivate a child object of the object that the script is attached to? To help explain that better its set up like this (I want to make the "Shoot" Game object stop for a few seconds and then start again).
Player (Game Object) with the "Collide" script attached to it. --Shoot (Game Object)
Thanks.
Comment
Answer by Tommynator · Dec 01, 2010 at 03:45 AM
You can just have a local reference to that child GameObject in your Collide script and then call gameObject.active = false
like this:
public class CollideScript: MonoBehaviour { [SerializeField] private GameObject _shootObject;
void OnCollisionEnter() { _shootObject.active = false; } }