Public access but not wanting it to show in the inspector?

Question… I have a script, ScriptA and I have other scripts access functions in ScriptA. All works fine but when ever I make a script Public so other scripts can access it, they show up in the GameObject/ Inspector as an editable object.

Is there a way to make these objects public, so other scripts can find them, but not have them show up under the inspector.

For instance… ScriptB sends a score change to Script A function that adjusts the score. I don’t need to access these in the inspector. I ask because I have 20 something public variables that are taking up space in the inspector.

I just spent an hour tracking down a bug because a number got placed in one of those public Int fields. This seemed to over ride the value I placed in code as the script was compiled.

Put the following tag above the variable.
[HideInInspector]

EDIT: Not certain which language you’re concerned about, the previous is for C# and the following is JavaScript.

@HideInInspector

1 Like

C#, thanks a lot! I’ll test it now!