- Home /
Same Scene - Different Button in One Script
Hi; first of all sorry for my english.
i have two button in my scene. button 1 name "settings" and button 2 name "stats". i have two scenes also same names. i want to go settings scene when i touch settings button and i want to go stats scene when touch stats button. so how can i do it in one script file with c#.
(i can do two scripts like this:)
using UnityEngine; using System.Collections;
public class nasilOynanir : MonoBehaviour {
public void nasilOynanir1()
{
if (Application.loadedLevelName == "anamenu")
Application.LoadLevel ("stats");
if (Application.loadedLevelName == "stats")
Application.LoadLevel ("anamenu");
}
}
Comment
$$anonymous$$aybe learn to format your script better, so the code you post is easier to read.
I know English is not your main language, but when you ask for help, providing a question that is clear to read will help people help you.
Your answer
