Error from unity scripting tutorial... UnityEngine.Transform.position not a variable...

Started by
1 comment, last by pengutech 11 years, 3 months ago
I'm pretty skilled with C#/XNA, but very new to Unity3D. I've gone through the video tutorials on Unity, now I'm following a YouTube video on adding scripts. Its in java, but I'm using C#.
">
Anyway, The code I'm entering is filled int from intellisense in mono develop (indicating that it can see the variables) But I'm getting an error about ...position not being a variable and I don't understand why.

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

Advertisement

I fixed the double to float issue if anyone notices that, but the same core error above is still plaguing me.

Moltar - "Do you even know how to use that?"

Space Ghost - “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer."

Dan - "Best Description of AI ever."

'this' refers to the script, not the gameobject, so you only need to put:

transform.position.z += 1;

In fact, you don't even need to put +=1 instead just use the shorthand version ++:

transform.position.z ++;

Is the final code, these tutorials were made quite a while ago and some of the unity api has changed since then.

This topic is closed to new replies.

Advertisement