- Home /
activating a Camera Using a Toggle Button
hey, i cannot seem to make this script work,, can anybody help me, here is the code
var camera: Transform;
var showMap = false;
var xAxis : int;
var yAxis : int;
function Start()
{
camera.enabled = false; // hide it
}
function OnGUI()
{
showMap = (GUI.Toggle (Rect (xAxis, yAxis, 100, 20), showMap, "Map"));
camera.enabled = showMap;
}
All I want is for the camera to activate and deactivate When i hit the Toggle Button Could somebody help ??
Thanks
Answer by syclamoth · Mar 21, 2012 at 10:04 PM
Make this line
var camera : Transform;
into this
var camera : Camera;
And then drag the camera itself into the slot, not the transform.
I already tried this, it didn't work :( anything else that would do it ?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
unknown identifer explosion problem 2 Answers
How to prevent an object from walking backward? 1 Answer
whay cant i move with this script???? 3 Answers