For some reason I’m getting the following errors:
NullReferenceException: Object reference not set to an instance of an object
MouseWorld.GetPosition () (at Assets/Scripts/MouseWorld.cs:30)
Unit.Update () (at Assets/Scripts/Unit.cs:20)
From Scripts:
public static Vector3 GetPosition()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Physics.Raycast(ray, out RaycastHit raycastHit, float.MaxValue, instance.mousePlaneLayerMask);
return raycastHit.point;
}
and…
if (Input.GetMouseButtonDown(0))
{
Move(MouseWorld.GetPosition());
}