untitled

Pasted Nov 18, 2026, 3:39 AM1 file28 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/roomspawningcode
untitled
  public RoomDatabase roomDatabase;
   private GameObject previousRoom;
   private int choiceInt;

   //database of rooms, then algorithm to spawn them ig? and initial spawn, they default to room pool
   // have to go over object pool video to figure out the deletion/storing
   // just get initial generation working
   //can just use a while loop nothing fancy


   //get the endpoint of the current room (roomDatabase.GetRoom(choiceInt)) and put the start point of the next room on that end point
   public int roomsPerLoop;
   void Start()
   {
       choiceInt = Random.Range(1, 9);
       //Initially starts at zero
       ObjectPooler.SpawnObject(roomDatabase.GetRoom(choiceInt), transform.position, Quaternion.identity);
       previousRoom = roomDatabase.GetRoom(choiceInt);

       //this spawns in 10 random rooms, now i have to configure start and endpoints
       for (int i = 1; i <= roomsPerLoop -1; i++)
       {
           choiceInt = Random.Range(1, 9);
           ObjectPooler.SpawnObject(roomDatabase.GetRoom(choiceInt), previousRoom.transform.GetChild(0).position, Quaternion.identity);
           previousRoom = roomDatabase.GetRoom(choiceInt);


       }

1,177 chars · codepastes.com