- Home /
MonoBehavior Ediotr vars
1) when i declare variable like public, it can be reached from editor, and from other scripts.
How can i hide this variable for other scripts?
P.S If i Whant to hide public variable from editro I simply use get / set functions. But What to do if I whant make public variable from Editor only?
Answer by whydoidoit · May 28, 2012 at 12:27 PM
You can use the attribute [HideInInspector] - c# or @HideInInspector - js to hide it, don't bother with the properties unless you need them.
You can't make a variable public only to the editor as far as I know.
ok, thx. that's helpful, but unfortunately still doesn't protect $$anonymous$$m from errors..
ups, [HideInInspector] - will hide it from Unity editor too. I need be able to edit variable from editor, and lock it from external script
As I said. Not possible. You could potentially write a custom inspector, give it friend like "internal" access status I guess.
Hmmm. Internal is only going to work if you manage to get the components into different assemblies too - the stuff you wanted protected would have to be in a plugin but it would be tricky to get the inspector to see it.
Your answer
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Cross project scripting? 1 Answer
How can an editor script know when another script was removed from the project? 1 Answer
Detecting serialization reload in editor 1 Answer
How to get variables of the script show in unity editor/inspector? 2 Answers