// Start is called before the first frame update void Start() { body = GetComponent <Rigidbody>(); //Add a rigidbody to the fox in the inspector rabbit = GameObject.FindGameObjectWithTag("Rabbit"); //On your rabbit GameObject, be sure to also add a "Rabbit" tag engineG = GameObject.FindGameObjectWithTag("Script"); //On your Animal Spawner Script, be sure to add a "Script" tag engine = engineG.GetComponent <createAnimals>(); //This is required to grab your spawner's script and use its methods }
private void Start() { Parent = GetComponentInParent <createAnimals>(); }