- Home /
Error Message: An object reference is required...
An object reference is required for the non-static field, method, or property 'tool.toolpos'
Hey, I'm getting this strange error message, and I can't find any conclusive support. Would you guys mind taking a look at my code? Thanks.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using UnityEngine;
using System.Collections;
public class tool : MonoBehaviour
{
public Vector3 toolpos;
public bool grabbed = false;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
toolpos = this.gameObject.transform.position;
}
}
Comment
change class to upper
i.e. Tool
code looks fine.
Also make sure the file name is the same as the class
Your answer
