Question by
adhominen · Mar 16, 2017 at 01:38 AM ·
buttonrandomscene-change
Someone Can Help me with this? Get scene id to load in prox level
Hi. Im tryin this but... i can´t. I´ve tried a lot of codes but nothing.
If someone can help me, thanks (i don´t know much about programming and unity).
using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;
public class sabias : MonoBehaviour {
int p;
//This button Goes on scene 1
public void Boton1(){
int y = SceneManager.GetActiveScene().buildIndex;
SceneManager.LoadScene (Random.Range(1,4));
Debug.Log(y);
}
//this button goes on scene 2
public void Boton2(){
p= GetComponent(y); //Im trying to come back to the last scene (previous)
}
}
In scene 1, i have a button, this take to one randomly scene. In next scene i have other button, and i want to come back to scene 1, so i can use the names of the scenes, cause i´ll go to a random scene.
Thanks!
Comment
Your answer
Follow this Question
Related Questions
Buttons Don't always work. 2 Answers
Scene Buttons not working after scene switch 0 Answers
Disabling random GUI Button from array 0 Answers
Why is my scene not loading? 2 Answers
C# Adding random values to array 1 Answer