I’m getting two when trying to organize my script. here are the errors:
Assets\Scripts\MouseWorld.cs(11,8): error CS0103: The name ‘instance’ does not exist in the current context
and
Assets\Scripts\MouseWorld.cs(22,72): error CS0103: The name ‘instance’ does not exist in the current context
and here is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MouseWorld : MonoBehaviour
{
[SerializeField] private LayerMask mousePlaneLayerMask;
private void Awake()
{
instance = this;
}
void Update()
{
transform.position = MouseWorld.GetPosition();
}
public static Vector3 GetPosition()
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
Physics.Raycast(ray, out RaycastHit raycastHit, float.MaxValue, instance.mousePlaneLayerMask);
return raycastHit.point;
}
}
if someone could help that would be great