- Home /
How to turn an object to a button.
I am using 3D Dynamic book and I want to know How I can do to turn an object to a button.
I am trying to use this function on C# but it doesn't works.
void OnMouseDown(){
gameObject.enabled=false;
Application.LoadLevel("Book");
}
First, I want to disappear an object and then I want to go to a different scene. I hope you can help me.
Answer by OrbitSoft · Oct 20, 2013 at 06:01 AM
Probably it doesn't work because you disable the object with the script so it won't execute anymore.
This script will disable only the mesh renderer so it basically makes it invisible but still active:
public MeshRenderer bookMesh; // In the inspector drag here the mesh renderer component
// of the book
void OnMouseDown() {
bookMesh.enabled = false;
Application.LoadLevel("Book");
}
Your answer
Follow this Question
Related Questions
Spawn Object On Gui (button Press) 2 Answers
UI button does not press if colliding with other UI object 1 Answer
Change 3D Object by pressing Gui Button 1 Answer
How to rotate boject using UI button? 3 Answers
Mobile Application Controls 0 Answers