Answer the question
In order to leave comments, you need to log in
How to attach LoadScene to specific objects?
The question is stupid, I don't know how to search in Google, but I'll ask here anyway.
I want to create 1 script that has a transition to other scenes, i.e. I have several buttons in the menu and I want to attach a script to them with a transition to scenes. I do with the help of SceneManager.LoadScene
Only here xs how to attach to the object
I write public GameObject the name of the object;
then to void OnMouseDown(){
SceneManager.LoadScene("Scene name");
}
and how to bind an object?
object name=SceneManager.LoadScene("Scene name"); object name doesn't
work.SceneManager.LoadScene("Scene name"); the same, the error is obtained (says that it is not possible to implicitly convert the void type to GameObject)
Answer the question
In order to leave comments, you need to log in
Here is an example on pure css , I think you will figure out how to specify the location of the rounding
Attaching a script to an object is Drag-n-Drop (and this is very commonly used throughout the GUI).
Check out the lessons!
Read the documentation .
If I understand correctly, on pressing a button, you are going to move through the scenes. If not, then sign up. So, you make a method, the same OnMouseDown put this method, with the library connected, everything seems to be fine here. Further, in the button components, there is OnClick (), you need to add a method from your script to it, add the script, and then take the method from it. Then, in order for the unit to see the scene, go to Fail -> Build and Project Settings, something like that. And above the menu where you select the platform Android, Pc, etc., click on + and add the scene you are going to work with, or drag it there with a dragondrop. I hope it helped
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question