Hello, I am working on a game ( kinda of but, i want to learn all the ins and outs of how to do things before starting ) This is something I have been wondering this is the code
I understand what the code does however I don’t know the code to change from when the object collides with the floors to if a player presses a button
function OnMouseDown () {
//Do some sexy stuff here
}
You would ad this to the GUITexture or a 3DText, or even scripted GUIButtons.
This is what you would also use if you want to make a gameObject to be the button. Just use functions OnMouseEnter, OnMouseDown and the like, then throw it on the gameObject and you're good to go..
Yeah sorry, my page hadn't refreshed when I wrote the answer ... :\ I hate that ... @MidnightPride: PeterDK's answer is the one you want! He answered first! :)
Thank you for all the responses and, they were helpful and, i will be keeping them in mind however I apologize for not being specific enough. I didn’t mean if they pressed a GUI button but, rather a keep board button ( Such as F ) as a result the world would load a new scene.
This is what you would also use if you want to make a gameObject to be the button. Just use functions OnMouseEnter, OnMouseDown and the like, then throw it on the gameObject and you're good to go..
– PetterDK