New answers tagged

0

You can add an OR case to your preprocessor directives to always include the field when serializing data in the editor, like so: #if SERVER_BUILD || UNITY_EDITOR public int someServerOnlyVariableSetInInspector; #endif #if !SERVER_BUILD || UNITY_EDITOR public int someClientOnlyVariableSetInInspector; #endif I'm sorry I neglected that case in my ...


0

Should the configuration files for entity types (be able to) just list all the component types an entity contains? No. As it's been pointed out in the comments, "You'd presumably want to store more than just the type of each component, but also the values of its relevant parameters/properties/fields." So, for example, your JSON file could look ...


1

Seem like a bug in Unity serialization, enumNames and enumValueIndex are unreliable for the inner enumeration type. But there is a good news that Unity provides fieldInfo property for PropertyDrawer, so we can get the type information. Here is the code and comments: if (property.isExpanded) { EditorGUI.indentLevel++; Rect fieldPosition = EditorGUI....


1

The Problem In Unity's Docs : [Serialize] Referenced values cannot be shared between UnityEngine.Object instances. For example, two MonoBehaviours cannot share an object that is serialized by reference. Use ScriptableObjects instead to share data. As Instantiate creates a new Unity Object, its data cannot be shared by reference by just decorating the ...


Top 50 recent answers are included