Access list from different gameobject script
I'm working on a small personal/learning game project.
Right now I have the basic movement & a few other things programmed, but I'm having difficulty with one specific aspect.
The game has a list of rooms, which it spawns when the player opens a door. Once a room has spawned, it needs to be removed from the list.
when I initially programmed this, I didn't realize that the script was creating the list on a per-object basis (each object that has the script attached to it has a different version of the list), i just thought it was a global list.
I now understand I need to create a global object that stores the available rooms, and allows another script to access and remove indexed items from that list. The issue is I have no idea how to access that list from another script on another gameobject.
Your answer
Follow this Question
Related Questions
Save gameobjects in a list before destoying 0 Answers
How do i make a game object grow by absorbing another game object ? 0 Answers
Trying to get the index of a gameObject in a list 0 Answers
How to check if tag collides with identical tag 1 Answer
How could I populate a list with a gameObject during runtime? 0 Answers