Error CS1061
Hey Guys, I wanted to make an Player Controller for a 2D Plattformer. But i keep getting the CS 1061 Error. Here is my code: http://pastebin.com/iN2RFSLw
Error is in the following lines; 33,45 and 35,27.
Full Error: Assets/Scripts/PlayerController.cs (xx,xx): Error CS1061: Type ´UnityEngine.Transform´ does not contain a definition of ´localScale´ and no extension method ´localeScale´ of type ´UnityEngine.Transform´ could be found (are you missing a using directive or an assembly reference?)
I wonder why I can not make transform.localeScale, because I see on google and in a YouTube Video, where I typed the full correct code from this guy, that it worked
YouTube Video (german, you can see the code at 20:22): https://www.youtube.com/watch?v=HebQN8RbgVU
It would be very helpfull if anybody could help me. Please dont laugh at my if I make any little mistake, because I'm new in Unity and C#
Answer by btmedia14 · Jul 23, 2016 at 07:12 PM
I believe the property name you are referring to is transform.localScale, and not localeScale The error message is indicating it cannot find 'localeScale'.
public void Flip()
{
lookingRight = !lookingRight;
Vector3 myScale = transform.localScale;
myScale.x*= -1;
transform.localScale = myScale;
}
And, note, no one is here to criticize, we are all here to help one another. Welcome to Unity and to C#.
At first, thanks for your reply! But, the code you send with the reply is exactly the code I wrote. Or am I wrong? I will test it soon when my Visual Studio is full installed
Sorry for my bad english, I'm from Germany :D
It is not exactly the same. Notice the spelling of the word localScale. It is spelled with only one letter e. In the version giving the error, it is incorrectly spelled as local*e*Scale. Hope this helps.
Gosh I'm so blind.. I'm sha$$anonymous$$g so much, thank you!