Search Unity

Error rendering drawer for AssetReference property

Discussion in 'Addressables' started by yomuhyeonseop, Sep 5, 2018.

  1. yomuhyeonseop

    yomuhyeonseop

    Joined:
    Nov 4, 2017
    Posts:
    2
    unity editor ver : 2018.2.6f1
    addressables ver: 0.3.3 - preview

    AssetReferences in my code are not rendered on Inspector

    Code (CSharp):
    1.  
    2. public class TestBehaviour : MonoBehaviour {
    3.     [System.Serializable]
    4.     public class DataSet {
    5.         public int intData;
    6.         public string stringData;
    7.         public AssetReference assetRefData;
    8.     }
    9.     [SerializeField] public DataSet dataset;
    10. }
    11.  
    error message:

    Error rendering drawer for AssetReference property Dataset.asset Ref Data.
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

    It is rendered properly when AssetRenference is member of MonoBehaviour(ScriptableObject)


    inspectorerr.PNG
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for reporting this bug. I've created a bug for it internally.

    -Bill
     
  3. takuyahimeji

    takuyahimeji

    Joined:
    Feb 26, 2016
    Posts:
    4
    The same error also occurs in version 0.3.5 Is this bug always fixed?
     
  4. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    This bug was not fixed in 0.3.5. It is still on the list to attack.
     
  5. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Any eta on this? Had to revert back to 0.2.2 to be able to use the system.
     
  6. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    I did not get an error, but it will be drawn with None if the address is one of the "implied" address. (The greyed out sub-address resulting from dragging a folder into Addressables pane, and everything including Scenes/Resources in the group "Built In Data")

    Using Debug mode of the inspector will reveal the real value inside.

    Screenshot 2018-09-18 18.53.37.png

    Screenshot 2018-09-18 18.53.27.png
     

    Attached Files:

  7. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    Ok I did get an error now. It happened when `AssetReference` member is not at the root of selected inspector drawing target. Submitted as a bug case #1082379

    If anyone want a dirty fix so that at least the editor is not crashing altogether, go to the package's source code and change the error line to this :

    Screenshot 2018-09-19 03.00.21.png

    Code (CSharp):
    1.             if (assetRefObject == null)
    2.             {
    3.                 var p = property.FindPropertyRelative("m_assetGUID");
    4.                 EditorGUI.PropertyField(position, p , new GUIContent());
    5.                 //Debug.LogError("Error rendering drawer for AssetReference property " + label.text + ".");
    6.                 return;
    7.             }
    When the bug occurs it will draw only the GUID box. You could manually copy asset's GUID to this box for the time being. (Not sure of side effects?)
     
    Last edited: Sep 18, 2018
  8. Rotary-Heart

    Rotary-Heart

    Joined:
    Dec 18, 2012
    Posts:
    813
    Unity : 2018.2.12f1, 2018.2.1f1
    Addressables: 0.4.6 - preview

    Issue still present, but now it doesn't print a warning since those lines were removed. Any news on this? I saw that the bug that @5argon posted above link is marked as fixed, but I still have the issue.
     
  9. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    How it works right now is that the field completely disappears if the drawer found a problem digging out the inner variable to draw. (Same situation, but nested fields will be blank instead of a log message) See this, below Element 0 is supposed to contain the AddressableAsset field. Only outmost AddressableAsset fields are drawn.

    Screenshot 2018-10-19 09.27.10.png

    If you want a quick fix to at least see something in this case, you can edit the code to my drawer according to here https://forum.unity.com/threads/assetreferencedrawer-does-not-dirty-the-serialziedproperty.568894/
     
    Rotary-Heart likes this.