dijital
February 10, 2013, 2:54pm
1
Hi,
Im in a bit of a bind, I need to be able to find, resize reposition a game object in one line
I can currently find and resize the game object using the code below
GameObject.Find("Wheel Front R").transform.localScale = new Vector3(57,57,57);
How do I add repositioning to this line?
Thanks in advance!
spendew
February 10, 2013, 3:37pm
2
I’m confused, are you trying to do all of this in one line of code? If so that isn’t really necessary.
Try this maybe?:
var insWheelFrontR : GameObject;
function Awake()
{
insWheelFrontR = GameObject.Find("Wheel Front R");
}
function Update ()
{
insWheelFrontR.transform.position = Vector3(0,0,0);
insWheelFrontR.transform.localScale = Vector3(1,1,1);
}
Always try to cache gameobjects, it saves valuable resources. Also why on one line? Multiple lines should be so quick that you would not even notice any slight delay.
dijital
February 10, 2013, 10:29pm
4
Looks like I didn’t need it on one line after all.
Thanks for the info!