hi guys,
another noob question…
i have attached this code to a GUI Text object:
var myX : float =0;
var myY : float =0;
var myZ : float =0;
function OnMouseDown(){
cameraDummy.transform.position = Vector3(myX, myY, myZ);
}
whats the syntax to tell my cameraDummy to move to the new positions?
cheers
Aiden,
Can you be a little more clear about what you are trying to do?
I’m also unclear what “cameraDummy” is as it is not defined in this bit of code. I’m also unclear what you are trying to move, as you have mentioned this is attached to a GUI Text object. What’s the relationship between cameraDummy and the GUI Text object? And what are the new positions you want to move to?
sorry, my bad 
I have several different GUI Text buttons on my screen, by clicking one of them im trying to move my camera to several different points around my scene. My camera is attached to an empty object called “cameraDummy” and thats the object im trying to reposition through an X, Y and Z Coordinate.
ive attached the above code to my GUI buttons but i have no idea how to directly target the cameraDummy.
hope that makes more sense 
thanks for your help
It does.
You need to explicitly find a connection between the code in your script and the camera.
I’m assuming you have your GUI Text Object working as a button? If not, add a “debug” line in your code and make sure your button is firing properly:
Debug.log ("This button works!");
Grabbing a reference. There are two usual ways to grab a reference to a game object within a script. The first is simply to declare a public variable (variables are public by default in Unity.js) which will create a “slot” in the inspector for that object. The other is to code a line that “finds” the game object. This gets a little more complicated, but once written is a little more bullet proof than the dragged reference.
To create a slot use:
var cameraDummy;
at the top of the script.
I prefer to be more detailed and actually explicitly assign the type to the variable, but this comes from iOS coding:
public var cameraDummy : GameObject
This will give you a slot to drag your cameraDummy into:

Add the cameraDummy Game Object:

Here’s the code:
var myX : float = 0;
var myY : float = 0;
var myZ : float = 0;
var cameraDummy : GameObject;
function OnMouseDown(){
Debug.log ("This button works!");
cameraDummy.transform.position = Vector3(myX, myY, myZ);
}
If you want to know more about GameObject.Find, look here:
As the page says, you should do your find in Start() and assign it to a variable.
OMG thank you so much Little Angel!! you have helped me out so much! hats off to you putting in images also 