- Home /
Question by
anishmariathasan · Oct 28, 2017 at 03:14 PM ·
2dtutorial
Why does the 2D UFO tutorial the script for moving UFO say compile error CS0101?
I have followed the 2d UFO course, but despite re-checking the script for moving the UFO, it comes up with . Any advice? (1st error message is fixed)
My code is this: using UnityEngine; using System.Collections;
public class CompletePlayerController : MonoBehaviour {
private Rigidbody2D rb2d;
void Start()
{
rb2d = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector2 movement = new Vector2(moveHorizontal, moveVertical);
rb2d.AddForce(movement);
}
}
capture.jpg
(182.8 kB)
Comment
Answer by TanselAltinel · Oct 28, 2017 at 03:32 PM
You probably have two scripts with the same name.
Open both CompletePlayerController.cs
and Playercontroller.cs
file to check their names. Make sure each file is named correctly with class name.
You shouldn't remove the file, you should only correct the names. Their file names were different but names were same.