Skip to content

How to Use objectReferenceValue – Unity Editor

Using objectReferenceValue with custom Unity editor fields can be tricky. The values don’t assign properly or you get confusing errors.

The key to making it work is to make sure the object you’re assigning is of type UnityEngine.Object.

Do not try to use UnityEngine.Object directly. It doesn’t work with memory management and your init will return null. Instead use ScriptableObject or MonoBehavior.

Published inCode ExamplesDevelopment Tips

Be First to Comment

    Leave a Reply

    Your email address will not be published. Required fields are marked *