G
G
GmDvlpr2020-01-20 20:25:05
css
GmDvlpr, 2020-01-20 20:25:05

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

5 answer(s)
A
A person from Kazakhstan, 2019-04-13
@LenovoId

On SVG - it's done...

J
jamster, 2019-04-13
@jamster

Use SVG tags https://svgontheweb.com/en/

V
Vladislav, 2019-04-14
@vos_50

Here is an example on pure css , I think you will figure out how to specify the location of the rounding

X
xmoonlight, 2020-01-20
@xmoonlight

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 .

D
DanielMcRon, 2020-01-20
@DanielMcRon

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 question

Ask a Question

731 491 924 answers to any question