I’m looking to add stairs to a procedurally generated dungeon floor. I only want one set of stairs on each level of the dungeon, in a random position. I’ve been working on arrays to solve my problem, by replacing one tile in the dungeon with a set of stairs. I’m trying to store the tiles in an array, then later retrieve their transform data for Instantiation purposes. I tried doing something like this:
void stairdig(){
Transform[] stairPosition;
stairPosition=GameObject.FindGameObjectsWithTag("room");
spotForStairs=(Random.Range(0,stairposition.Length+1));
Instantiate(stairs, spotForStairs, spotForStairs);
}
but unity tells me that i can’t simply turn a game object into a transform with this code.
is there a way for me to get the transform data from these objects so I can instantiate the stairs in their place?
thanks in advance!