I don’t know if this is the right place but i looked throught like 3 pages of google and none worked i’m just trying to make a public variable and they don’t show
- Make sure you don’t have any compile errors
- Make sure the variables in question are on a MonoBehaviour, ScriptableObject, or a serialized class that is itself a field of one of those objects
- Make sure you are looking at the inspector of an actual object, not the script itself.
All else fails, share your code and screenshots of the inspector window here.
I thought i need to fix errors only in the script fixed now also i’m new to unity so yea thanks!
Nevermind it shows but another script can’t access it
That’s maybe because you need to access these variables through an instance of the script, not by referencing the script’s class. If you’re referencing the variables like this:
ExampleScript.variableName
…you will only be able to access static members of the ExampleScript class. However if you do this:
ExampleScript instance = FindObjectOfType<ExampleScript>();
if (instance.variableName)
{
// Do something
}
…then you’re retrieving an instance of the class and will therefore be able to access its non-static public members (variables/properties/methods).