Jump to content

  • Log In with Google      Sign In   
  • Create Account


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


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Dan Violet Sagmiller   Members   -  Reputation: 896

Like
0Likes
Like

Posted 28 December 2012 - 11:54 AM

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."

My Game(s), Warp Wars is in early development and can be found here: http://blog.WarpWars.Net.


Sponsor:

#2 Dan Violet Sagmiller   Members   -  Reputation: 896

Like
0Likes
Like

Posted 28 December 2012 - 12:05 PM

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."

My Game(s), Warp Wars is in early development and can be found here: http://blog.WarpWars.Net.


#3 pengutech   Members   -  Reputation: 129

Like
1Likes
Like

Posted 28 December 2012 - 12:28 PM

'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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS