Why does this not work?
Error: Assets/Dodacminuta.cs(21,7): error CS0120: An object reference is required to access non-static member `Lol.timer’
Why does this not work?
Error: Assets/Dodacminuta.cs(21,7): error CS0120: An object reference is required to access non-static member `Lol.timer’
When you call a Class by its name and query a property, like you do with Lol.timer, the property must be at the class root level, what we call a static member.
You probably meant to assign the result of GetComponent(“Lol”) to a Lol member in the first script.
Like :
Lol lol;
void Start ()
{
lol = timer.GetComponent<Lol>();
}
public void Function ()
{
lol.timer = 0f;
}