- Home /
Why won't this compile?
I get an error for an unknown Identifier, yet I don't know how to fix it. Can someone help me with this?
#pragma strict
function Start () {
}
function Update () {
if(Input.GetKeyDown (KeyCode.A))
Transform.Translate(Vector3(-3,0,0));
if(Input.GetKeyDown (KeyCode.D))
Transform.Translate(Vector3(3,0,0));
}
Use a lower cased t on transform. Transform is a Type, transform is a reference to your GO.
https://docs.unity3d.com/Documentation/ScriptReference/Transform.Translate.html
still doesn't work, but thanks for the help!
still doesn't work doesn't really help me. Same error?
Same problem. I might need to reinstall mono develop. Thanks everyone for your time.
Yep, that's the whole script. If it's removed, it works fine.
Sooo.. Is it working, or not? If not, what's the error? If yes, make a mod or someone with rights convet the comment with the solution to an answer and flag it as accepted.
Not sure why, but when I converted my answer to a comment other comments were removed. OP is still experiencing issues, @Bunny83 suggested to be sure script names do not match library or built in struct or class names, that comment got removed too.
Answer by clunk47 · Apr 26, 2014 at 02:10 AM
#pragma strict
function Start ()
{
}
function Update ()
{
if(Input.GetKeyDown (KeyCode.A))
{
transform.Translate(Vector3(-3,0,0));
}
if(Input.GetKeyDown (KeyCode.D))
{
transform.Translate(Vector3(3,0,0));
}
}
Is working fine on my end.
Your answer
Follow this Question
Related Questions
How to rotate 90 degrees 4 Answers
Ref modifier 1 Answer
A node in a childnode? 1 Answer
Mover Player With seesaw 1 Answer
problem with gui??? 0 Answers