- Home /
Set the position of a transform object
Hi, i have a problem with setting the position of a transform in a script.
The part of code with the error:
private Transform bacino;
bacino = UnityUtils.FindTransform(go, "MasterMover1");
bacino.position = Vector3(0,0,0);
The error:
Assets/Nite.cs(251,37): error CS0119: Expression denotes a 'type', where a 'variable', 'value' or 'method group' was expected
bacino.rotation works but bacino.position not... why?? Thanks Regards, Christian
Comment
Best Answer
Answer by KeithK · Apr 04, 2011 at 02:20 PM
You need to create an instance of Vector3 when assigning to position.
Like this:
bacino.position = new Vector3(0,0,0);
Your answer
![](https://koobas.hobune.stream/wayback/20220613120646im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why does transform.position.Set() exist? 1 Answer
transform.position on basis of rotation 0 Answers
Transform positions being strangely specific 1 Answer
can't use camera position in equasion, help! 2 Answers
transform position vectorially 2 Answers