I'm trying to create a zoom in button, in my unity scene I saw this video, but the 'zoom cam' isn't working. Thank you
CodePudding user response:
My guess is that OnMouseDown() isn't getting called. That function has a specific use case, as you can read in the docs. The script might not be attached to the correct collider, etc. If you want to trigger it from a button, you can - add it to the list of functions triggered by the button's OnClick() through the inspector. Tons of YouTube tutorials for that sort of thing.
CodePudding user response:
Is there any other camera in the scene beside the 'zoom cam
', maybe the 'Main Camera
'?
If so, try to disable the other camera by adding the following line
GameObject.Find("Main Camera").GetComponent<Camera>().enabled = false;
in the script "ZoomIn" at line 17