Unity CS0120: An object reference is required for the non-static field, method, or property 'Variable'?
Hallo,
Ich habe den Fehler CS0120: An object reference is required for the non-static field, method, or property 'Variable' in meinem Unity Projekt bekommen.
Ich habe online gelesen, dass das passiert, wenn man aus einer statischen Methode eine nihct statische Variable aufgerufen wird. Aber ich habe keine einzige statische Methode in meinem Code. Woran könnte das noch liegen?
public class NewBehaviourScript1 : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Debug.Log(MainClass.hi());
}
}
public class MainClass
{
public void hi(){
Debug.Log("hi");
}
}
Ich hoffe auf Hilfe,
Bohne47