New to Unity and C#
Trying to follow a tutorial on building a 2D game.
i have this script:
using UnityEngine;
using System.Collections;
public class BeppoScript : MonoBehaviour {
// Use this for initialization
public Camera cam;
void Start () {
if (cam == null) {
cam = Camera.main;
}
}
// Update is called once per physics timestamp
void FixedUpdate () {
Vector3 rawpos = cam.ScreenToWorldPoint (Input.mousePosition);
Vector3 tgtpos = new Vector3 (rawpos.x, 0.0f, 0.0f);
Rigidbody2D.MovePosition (tgtpos);
}
}
but it gives an error in the engine:
Assets/Scripts/BeppoScript.cs(19,29): error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody2D.MovePosition(UnityEngine.Vector2)'
Not sure what the fix is.
sidenote:
That MonoDevelop thing doesn’t respond to any inputs outside of the text editor part; i can’t close it or access any of the options.
If anyone has a fix for that, it would be great.