How to use variable in Static function?

I want to use static function for short scripting.

So I made it.

But when I try access from other script, error says non-static variable in static function.

Then, how can I use variable in static function?

I need variable that can be manipulate in the inspector.

Or how can I achieve same thing via another way?

Thanks.

When you make a static function, nothing really changes, rules stays the way they are. So, if you want to access the variable HitPoints of a gameObject, for example :

Why do we need to specify the gameObject, even though the variable is inside the same script ? Because hitPoints is a non static variable and is linked to a gameObject.

And when you call GetHitPoints, because it is static, it is not related to any object (lets say you call it from your project panel, place where it is not assigned to any gameObject).

So if you were to write return hitPoints it would fail.