|
So on my main camera I have a script to zoom in, and on my GUITexture I have a script that makes it a button Here is my Zoom.js script, and here is my ZoomButton.js script, I want to make it so when I press the button it will activate the script on my main camera. I believe the issue is I don't know how to call on the button being pressed to active the zoom function Appreciate all and any help, Thanks!
(comments are locked)
|
|
just move the line into the touch statement(also combined to single script): note: if you don't want to attach this to your camera , it wouldn't be a problem as long as your camera is tagged as "Main Camera".. you just change the lines that say camera.fieldOfView = etc... to Camera.main.fieldOfView = etc... then it doesn't matter what the script is on
Jul 25 '12 at 11:26 PM
Seth Bergman
(comments are locked)
|

you could have a go with using enabled = true and false, enable the zoom script when touched and disable when let go.
or you could use a while statement so in your guy script you will call a separate function in the zoom script and that will have a while guy is pressed.
me personnally i wouldn't have two different scripts, as having more than needed update functions can slow down the game especially on the iPhone, i always try to have one update, running at any time, sometimes its unavoidable, but a lot of other stuff can be done through different functions.