Immutable struct Property Drawer
I have a custom struct that is immutable: all its properties are private, and it is assigned as a numerical value. How can I make a PropertyDrawer assign a new values directly to the property it's drawing?
I heard I should have the drawer started with something like this :
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label){
object target = property.serializedObject.targetObject;
MyStruct? value = target as MyStruct?;
}
...but value always ends up being null here.
Then after I manage to grab the value of the target object, how can I send it back into the target object ?
Your answer
Follow this Question
Related Questions
List of Structs variable values not changing 1 Answer
serializedObject.FindProperty working on Windows, not working on Mac. 0 Answers
[Resolved] Native Array of struct containing different types. Error InvalidOperationException 3 Answers
Custom Class Property Drawer 1 Answer
JsonUtility.FromJsonOverwrite not working with structs 1 Answer