I have been trying to enable a spawn script i have on when it gets that that particular state, and then off when the state switches. I have had no luck with it at all. i also am going to have a lot of spawn scripts so i want to put them into an array. Has this even been done before. i cant seem to find anything on it in C# on Google.
I have been trying to use GetComponent().enabled = true; but it does not work.
This is my spawn script on the empty game object:
public class AblockSpawn : MonoBehaviour
{
public GameObject Ablock;
// Use this for initialization
void Start ()
{
Ablock = (GameObject)Instantiate(Ablock,
new Vector3 (-0.03817695f, -0.03485581f, 4.391333f), transform.rotation);
}
// Update is called once per frame
void Update ()
{
}
}
im calling the GetComponent().enabled in another script at the start of one of my states. and then turning it to false when the state switches. i have 26 of these so that is why i want to put them in an array.