- Home /
Custom Editor - Prevent Serialization of a specific variable
Hi,
I have a variable that I do not want serialized in a Custom Inspector, but I also need other Custom Inspectors to serialize the variable. [HideInInspector] is not enough as the variable is still serialized.
For Example:
List<SomeClass> someList;
Class SomeClass
{
public int someInt;
// Prevent this from being serialized in one custom inspector, but be serialized in another.
public string someString;
}
Any ideas?
Thanks.
HN
Fields in classes are either serialized always or never, it's not possible for them to be sometimes serialized depending on the caller. What behavior are you trying to create? There's probably a workaround to do it.
Thanks zach, that pretty much answers the question, I just wasn't sure of the Unity Inspector was able to handle things a bit differently.
Answer by IgorAherne · Aug 04, 2015 at 11:09 PM
http://answers.unity3d.com/questions/199691/nonserialized-vs-hideininspector-question.html
[NonSerialized]
Hi Igore, thanks for replying! I've already been through that post, [NonSerialized] affects all other custom inspectors when tested. Unless I'm missing something?
Your answer
Follow this Question
Related Questions
Bool array to binaryformatter method 1 Answer
Is it possible to create a custom gettter/setter on SerializedProperty ? 0 Answers
Serialized Fields go bye bye on Android 0 Answers
How do I save scripts as variables in the inspector? 0 Answers
EndOfStreamException : Failed to read past end of stream 1 Answer