i’m trying to make a part of procedural level generation with this
public class WallMaker : MonoBehaviour
{
public GameObject walls;
void Start()
{
int rand = Random.Range(0, walls.Length);
Instantiate (walls[rand], transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
i tried to parent the instantiated object by adding “transform.parent” with all manner of different capitalizations, into many places in the script but i don’t know how to do it correctly. i need the spawned walls to face the center of the room (obviously) but i don’t know what the best way to go about this is. do i really need to make different scripts or variables for walls facing different directions? or is there a way for the instantiated object to just inherit the orientation from the parent object?
i tried looking up how all the pieces of the code work and what you can do with them but i’m just not well versed in c# yet to understand this
