How to attach LoadScene for certain objects?

Silly question, I MB don't know how to Google, but still I ask here
I want to create 1 script, in which there is a transition to other scenes, ie I have a menu has several buttons and I want them to attach a script with the transition to the stage. Do with SceneManager.LoadScene
Only good as to attach to the object
Public GameObject write the name of the object;
then in void OnMouseDown(){
SceneManager.LoadScene("scene Name");
and how to bind the object?
object name=SceneManager.LoadScene("scene Name"); is not working
the name of the object.SceneManager.LoadScene("Name of scene"); the same error happens (says cannot implicitly convert type void to GameObject)
April 4th 20 at 13:03
2 answers
April 4th 20 at 13:05
Attach a script to the object - Drag-n-Drop (and is very often used around the GUI).
View the lessons!
Read the documentation.
April 4th 20 at 13:07
If I correctly ponel, by pressing the button, you're going to go for scenes. If not, then write a review. So, do method, the same OnMouseDown put this method, with connected library, then like you have all the rules. Further, in the components of the button has a OnClick(), you need to add a method in your script, the script added and then method it take. Then to unity saw the scene, go Fail - > Build and Project Settings, something like that. And on the menu where you choose the platform Android, Pc, etc. click on + and add the scene you want to work or dragondrop to drag her there. Hope I helped

Find more questions by tags Unity Game Engine