- Home /
This question was
closed Jan 08, 2015 at 10:45 PM by
Graham-Dunnett for the following reason:
Duplicate Question
Errors in Unity2D
I keep getting 2 errors. It is a very basic code that i have written before and it worked well for me. But I can't find whats wrong with it. the errors are "Assets/Scripts/player.cs(12,14): error CS0116: A namespace can only contain types and namespace declarations" and "Assets/Scripts/player.cs(21,1): error CS8025: Parsing error"
using UnityEngine;
using System.Collections;
public class player : MonoBehaviour {
// Use this for initialization
public Vector2 jumpForce = new Vector2 (0, 300);
}
// Update is called once per frame
void Update ()
{
// Jump
if (Input.GetKeyUp("space"))
{
rigidbody2D.velocity = Vector2.zero;
rigidbody2D.AddForce(jumpForce);
}
}
}
Comment