UI Button ( OnClick event ) [Tutorial][C#] - Unity 3d

preview_player
Показать описание
In this one, we learn how to use the OnClick event that the Button component gives us to call a function we've defined somewhere in our code using a real example.

►-------------------------------------------------------◄
Join the community, keep on learning.

► Come hang out in discord! This is the most efficient way to reach not only the team members but thousands of other developers like you! We love it when you help, showcase or just discuss with each other in discord!

► Learn about unity and game design with this playlist:

► If you enjoy what I do here and would like to support me, pledge any amount on Patreon.

►-------------------------------------------------------◄
Stay up to date!

N3K is friendly, laidback community that helps you create video games, and make friends while doing so. Check out our website to learn more, or join us on discord!

► Keep up to date with our plans! Follow the Facebook page

►-------------------------------------------------------◄
More content!

Do you need some ideas?
Try out our Unity Training playlist!

Рекомендации по теме
Комментарии
Автор

It is the perfect tutorial because I was looking for such information in other websites and couldn't do it because there was not exactly information about what I want. But after watching this video, I was able to make my first the SceneManagment script. Thank you for your detail explanation, I highly appreciate it!!!

Kirill_Soldatov
Автор

Very quick, good tutorial on what to put where for the On Click () component, thanks!

Kyrital
Автор

Short, simple, and brilliant!! Thanks for making this!

Toebiscuit
Автор

Damn this was perfect. No extra BS just straight to the point!!! Excellent, thanks so much!

marioroberti
Автор

THXS
I have been Searching for 4 days!
THX!!

jeef
Автор

Thank You very much. It was exactly what i was looking for!
And thank you again for, as said before, keep it simple and straight to the point.

nnao
Автор

Great little video, helped me to understand how the buttons can interact with a script. Thanks!

InfurnusUK
Автор

it is 2 am in the morning, great video thanks!

ethanshover
Автор

This is the only tutorial that worked! Thanks!

XhaustionYT
Автор

Mahalo for keeping it simple and to the point. I'm signing up.

leilanis
Автор

Im So happy I found this Much Simpler than the other Options! Thank you!

atomiccloud
Автор

Good job being simple and getting to the point... Subbed! :D

Steven-nbup
Автор

Thanks for being detailed, helped solve my problem.

blootiger
Автор

Thank You! Keep up the good work man! This is solid content! :)

ragestudios
Автор

Nice! Still getting to grips with unity and this really helped!

theduckyt
Автор

HI I need help when I asign on the Onclick buton the script. Afther that I cant select the methods of that script it doesnt apeear on the list only appears: no function, monoscript and inside this string name.

viktorromero
Автор

rapido, consizo, certero y al punto, excelente video!

expedientesparanormales
Автор

I have a issue :/

I can't connect the function I made in my build management script to the button. It just doesn't appear in the on click list no matter what I do. :(

olivermorrison
Автор

Select Button: Click on the button in the Hierarchy.

Add Click Event:
In the Inspector, find the OnClick() section.
Click the + button to add a new click event.

Assign Object:
Drag the GameObject with the SceneSelector script attached (e.g., MainCamera) into the Object field of the new click event.

Select Method:
In the dropdown, find and select the SceneSelector -> LoadScene(string) method.

Add Parameter:
In the String field that appears, enter the name of the scene you want to load.

This will set up the button to load the specified scene when clicked.

MadsHagelund
Автор

Hey I'm trying to change the text of my button from a script so that when the button is clicked the text will change to something like "button has been clicked"

hyelnijoshuaali