Search Unity

[Bug] UIElements Logged Error when trying to assign an AssetReference

Discussion in 'Addressables' started by james7132, Jul 19, 2018.

  1. james7132

    james7132

    Joined:
    Mar 6, 2015
    Posts:
    166
    Code (CSharp):
    1. Capture has no panel, forcing removal (capture=IMGUIContainer  (x:0.00, y:0.00, width:396.00, height:200.00) world rect: (x:0.00, y:0.00, width:396.00, height:200.00) eventType=null)
    2. Should not be capturing when there is a hotcontrol
    This is while attempting to set any AssetReference to an Addressable asset. This does not assign the reference at all.

    Unity Version: 2018.2.0f2
    Package Version: 0.1.2
    .NET Runtime: 4.x+ w/ .NET Standard 2.0

    Bug Case: 1062060

    Separate bug: AssetReferenceTypeRestriction does not work. It still shows every possible asset.
     
    Last edited: Jul 19, 2018
    Cedric-Bidaud likes this.
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Hi James, I've worked on reproducing this, and want to make sure I understand the issue...
    - if you use the dropdown to set your AssetReference to anything other than none, it logs some info messages about the UI not behaving correctly, but it still works. Is that last part right? That it still fully functions, it just logs a message?
    - if you set the reference to "none" it's totally broken. After attempting to set it to "none", you can still use the dropdown to set it back to something else, though.
    - if you drag an asset onto the AssetReference, nothing is broken.

    Does all of the above seem correct?

    Thanks for trying out the system,
    Bill
     
  3. james7132

    james7132

    Joined:
    Mar 6, 2015
    Posts:
    166
    The AssetReference if set to some non-None value via the dropdown it logs some messages about UIElements, then makes no visual or serialized data change.

    The AssetReference if set to some None value via the dropdown, it throws a NullReferenceException, control continues to be "usable". Stack Trace:

    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. UnityEditor.AssetDatabase.TryGetGUIDAndLocalFileIdentifier (UnityEngine.Object obj, System.String& guid, System.Int64& localId) (at C:/buildslave/unity/build/Editor/Mono/AssetDatabase/AssetDatabase.bindings.cs:85)
    3. UnityEditor.AddressableAssets.AssetReferenceDrawer.SetObject (UnityEditor.SerializedProperty property, UnityEngine.Object obj, System.String& guid) (at D:/Users/james/AppData/Local/Unity/cache/packages/packages.unity.com/com.unity.addressables@0.2.1-preview/Editor/GUI/AssetReferenceDrawer.cs:30)
    4. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
    Dragging to the reference seems to be the only method that works. Did not try to drag it in before.

    This was retested with version 0.2.1-preview of the package
     
  4. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    In my tests, selecting a legitimate entry from the dropdown will throw the info message, but will also properly mark the scene as dirty, and be saved when the scene is saved. Either way, it needs to be fixed so it doesn't log the message. Hopefully fixing that will also fix your lack of serialization issue. The bug has been added to our tracking system.
     
  5. james7132

    james7132

    Joined:
    Mar 6, 2015
    Posts:
    166
    I don't think I was using AssetReferenceTypeRestriction on AssetReference, which also doesn't seem to limit the options in the dropdown.