Search Unity

Using AssetReference.editorAsset in OnValidate() logs an error

Discussion in 'Addressables' started by isaac-ashdown, Aug 31, 2021.

  1. isaac-ashdown

    isaac-ashdown

    Joined:
    Jan 30, 2019
    Posts:
    69
    Hello,

    I want to call .editorAsset in my ScriptableObject's OnValidate() functions, but I get the error "
    SendMessage cannot be called during Awake, CheckConsistency, or OnValidate" when I do. It appears to work fine, but the error is annoying as it prints a lot.

    I want to just get the actual asset here so I can do validation on it and the referencing ScriptableObject. Is this not supported? Is there another way to do this? (I've tried using AssetDatabase.GUIDToAssetPath then AssetDatabase.LoadAssetAtPath, but it also prints this error).

    Thanks!