Search Unity

Addressables fails to load asset if name contains "[ ]"

Discussion in 'Addressables' started by Zargy, Feb 15, 2020.

  1. Zargy

    Zargy

    Joined:
    Jul 13, 2014
    Posts:
    17
    What it says in the title. Addressables 1.6.2 fails to load an asset if the asset name (not the path) contains any instance of either bracket.

    I have an otherwise empty project with a default sphere made into a prefab, and a script to import an asset reference on start.
    upload_2020-2-15_14-56-18.png

    Code (CSharp):
    1. public class TestImport : MonoBehaviour
    2. {
    3.     public AssetReference     assetRef;
    4.     public GameObject        test;
    5.  
    6.     void Start()
    7.     {
    8.         assetRef.LoadAssetAsync<GameObject>().Completed += handle => test = handle.Result;
    9.     }
    10. }
    If I start the game with this setup, the asset loads into the field fine.
    upload_2020-2-15_14-58-10.png

    However, if I rename the asset to this:
    upload_2020-2-15_14-58-39.png

    I get these errors: https://pastebin.com/kUzjPK0J

    Can anyone else reproduce this issue? I assume this is a bug but I want to make sure before I file a bug report that there's nothing I'm obviously doing wrong or any documentation that I've missed that explains why this would happen.

    (This is on 2019.3.0f6)
     
  2. davidla_unity

    davidla_unity

    Unity Technologies

    Joined:
    Nov 17, 2016
    Posts:
    763
    Hey so I think you're seeing that because internally sub objects are delineated by having the sub-object name inside square brackets. We need to update the documentation to explain this if we haven't already but that specific naming style is something we won't be able to support. Apologies for the inconvenience.
     
  3. Zargy

    Zargy

    Joined:
    Jul 13, 2014
    Posts:
    17
    Thanks for your reply. Please do find the time to update the docs explaining this naming convention edge case. I'm having some difficulty understanding why the system was designed to have this naming limitation, though I'm sure there was at least one good reason.