- Home /
Did not understand basic coding concepts before writing answer. OP Learned up and now face-palms at this dumb question.
Remembering Previously Loaded Scenes "Doors"
Hey, I am making a game just to try out some mechanics i might use in a later game. It uses Randomly selected scenes from a list, to simulate a random world. You leave out of a door, it loads a random scene, etc. The problem with this is i have no idea how to make it so that if you want to go backwards into the door, it will load the scene you were already in, instead of a random one. I have no idea where to start, but i was thinking playerprefs? Hopelessly Lost, been searching for hours for a solution that might not exist. Then again, I am a novice Csharp-ist.
Any help would be greatly appreciated.
-Archy
Well its not so much as remembering open doors (Though i might use that) but remembering which scene corresponds to which door. For example if i go into a door on the left, it would randomly generate a scene. then if i want to go back through the door i just came through, it'd randomly generate another scene ins$$anonymous$$d of loading the one i was just in. I want to do the latter option.
A good example is The Binding of Isaac door mechanics. It will make a random level, then if you go back through the door it will take you to where you started.
Answer by rensjan2122 · Dec 18, 2014 at 09:57 PM
Create an empty GameObject with this code:
String[] DoorTarget= new String[#Doors];
void Start(){
DontDestroyOnLoad();
}
public void DoorCollision(int DoorId){
this.id =DoorId
Application.Load(DoorTarget[id])
}
Every door has an Id and every id is linkt to an target you call this function with an Id, I think this would work but I didn't test it so...
So would i make four Public GameObject lines to reference all four doors?
or an array of GameObjects with every door having the same place in the array as his id