Jump to content
  • Advertisement
Sign in to follow this  
hpdvs2

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

This topic is 2029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.  
 
 

Share this post


Link to post
Share on other sites
Advertisement

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

Share this post


Link to post
Share on other sites
'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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!