- Home /
Question by
animeman0 · Jun 13, 2015 at 01:30 PM ·
c#programmingunity 4.6
Can someone help me please. error CS1519
I'm new to c# and I was watching a tutorial, I got this basic movement script and tweaked it a tiny bit. But it wont work:
using UnityEngine;
using System.Collections;
public class Movement : MonoBehaviour {
public float speed = 6.0f
Animator anim;
void Start()
{
anim = GetComponent<Animator> ();
}
void Update()
{
PlayerController ();
}
void PlayerController()
{
anim.SetFloat("speed", Mathf.Abs(Input.GetAxis ("Horizontal"))); //setting the float parameter called "speed" depending on the input from the horizontal axis
if(Input.GetAxisRaw("Horizontal") > 0) // if d or right key is pressed
{
transform.Translate(Vector3.right * speed * Time.deltaTime); //move right 4 pixels at a fixed framerate
transform.eulerAngles = new Vector2 (0,0);
}
if(Input.GetAxisRaw("Horizontal") > 0) //if a or left key is pressed
{
transform.Translate(Vector3.right * speed * Time.deltaTime);
transform.eulerAngles= new Vector2(0,180); //rotates gameobject by 180 degrees horizontally
}
}
}
This is my error: Assets/Scripts/Movement.cs(8,16): error CS1519: Unexpected symbol `Animator' in class, struct, or interface member declaration
Help is much appreciated
Comment
Best Answer
Answer by DoTA_KAMIKADzE · Jun 13, 2015 at 01:31 PM
You forgot semicolon in line #6, e.g.:
public float speed = 6.0f;
Your answer
![](https://koobas.hobune.stream/wayback/20220613200934im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to check if your character is falling 2D - C# 1 Answer
Distribute terrain in zones 3 Answers
Add Cyrillic to TexMeshPro?,Add krill to TexMeshPro? 0 Answers
C# GameObject Lists 2 Answers