#button onclick scene change
1 messages · Page 1 of 1 (latest)
Hi Thanks
do You know how to attach a function to a button
No currently not
on the bottom of the button component is there an "On Click" Section?
Yes its empty
click the plus sign
Yes
Select a component with the desired function
In this case
you have to create a component which has the scene changing function
Yeah uhm, i'm currently only working on the mainpage
Can you create a test scene
wait wait
I have created an image background, but its in the front, how to put it in the back?
change the hierarchy
does the button work
how to create a test scene?
and btw, i need the button to work on touch
scene
got it
Do you know how to create c# components
right click and create and c#?
yes
add a function to that component
which changes the scene
You can do that by SceneManager.LoadScene("Scene Name");
what
Do I need to create different scenes for like mainpage, options and the game scene?
So I want to do a 2D Game for android
for options if you want to make an overlay to the original scene you dont have to
So I can let everything in one scene?
what to you recommend
make a scene
also different scenes for each like options etc.
If you want to overlay the settings then you have to make option into a prefab
You cannot separate a pause menu into a scene because loading a scene will cause already existing objects to be destroyed(You can avoid this by using something like DontDestroyOnLoad but I dont recommend this)