I’m trying to instantiate something and I need to set the instantiated object to a variable so that I can destroy it later.
Here’s the code:
public static Transform attackObj; (Had to make it static in order to edit in another script)
attackObj = Instantiate (attackRouteObj, attackingCity.transform.position, Quaternion.identity) as Transform; (Inside an if statement)
Debug.Log (attackObj);
The dbug log shows up null, even after the object has been instantiated.