Search Unity

Why might some assets instantiate fine and others not?

Discussion in 'Addressables' started by rbabiuch, Aug 13, 2019.

  1. rbabiuch

    rbabiuch

    Joined:
    Jul 22, 2019
    Posts:
    4
    As the title suggests, I have a simple prefab named "box" that I can instantiate successfully. No drama. I have another much more complicated prefab called "complex" with an animator, collider, a ton of children who act as joints and maybe some particle effects + custom materials attached. This prefab does not instantiate successfully, and instead throws an InvalidKeyException upon calling Addressables.InstantiateAsync().

    Are there guidelines on how to prepare an asset for load besides just assigning an address to it?
     
  2. rbabiuch

    rbabiuch

    Joined:
    Jul 22, 2019
    Posts:
    4
    Bumping this question and following up: I turned on full logging and found the catalog json file. Interestingly enough, "box" is included in the "m_Keys" array, but "complex" is not...even though it appears in the Addressables window.

    Why would something appear in the addressables window, but not in the collection of keys in the catalog?
     
  3. rbabiuch

    rbabiuch

    Joined:
    Jul 22, 2019
    Posts:
    4
    I've found the culprit. The "complex" prefab had ghost mono behaviours attached to it from calling GameObjectUtility.RemoveMonoBehavioursWithMissingScript() where the missing scripts no longer appear in the inspector, but still appear in the YAML-based asset files.
     
    unity_bill and magmagma like this.