I have a C# script in unity which is instantiating a prefab. (This works fine).
Once This happens I need to access an array, stored on a script, on that prefab.
public static void roomBuilder(Vector3 loc)
{
if(roomcount < 20)
{
GameObject newRoom;
int roomNum = (int)(Random.Range(0, staticRoomArray.Length));
newRoom = Instantiate (staticRoomArray[0]) as GameObject;
Component value = newRoom.GetComponent<Room_adder>();
Debug.Log(value.doorArray[0]);
newRoom.transform.position = (newRoom.transform.position) + loc;
}
}
This is the function Instantiating the prefab.
The instantiated prefab has a script with a “public GameObject doorArray;”.
Any thoughts on how to make this work?