- Home /
Question by
JulySellanes · Feb 07, 2018 at 03:54 PM ·
errorscript.variablestaticfirstpersoncontroller
Unity how to access a static variable from the FirstPersonController component
Hi, what I want to do in the FirstPeronController script is:
if (PauseMenu.IsOn)
{
...
}
But I get an error, I do not understand why I can not access
Comment
1) What is the error? 2) Can you show us the part of your code where you declare the static field?
Answer by hexagonius · Feb 07, 2018 at 09:37 PM
IsOn needs to be declared like:
public static bool IsOn;
or
public static bool IsOn(){}
or
public static bool IsOn{get;}
Answer by JulySellanes · Feb 08, 2018 at 04:05 PM
For those who ask
staticbool.png
(126.2 kB)
if.png
(264.2 kB)
Your answer
Follow this Question
Related Questions
Is it possible to use scripts without MonoBehaviour on GameObjects? 1 Answer
Global Variables Refuse to Cooperate 1 Answer
I am having an error in my script 1 Answer
Need help with post processing error. 4 Answers
Scripting error! 1 Answer