Unity-Technologies / Addressables-Sample

Demo project using Addressables package
1.29k stars 298 forks source link

SyncAddressables sample doesn't work 2019.4.17f1 with Addressibles 1.16.16 #48

Open twhittaker opened 3 years ago

twhittaker commented 3 years ago

The SyncAddress sample code doesn't work when loading multiple prefabs.
Simple Repro: Change the FixedUp code to load 2 cubes and the exception throws with the load percentage at 0.5

Exception: Sync Instantiate has null result Cube
SyncAddressables.Instantiate (System.Object key, UnityEngine.Transform parent, System.Boolean instantiateInWorldSpace) (at Assets/SyncAddressables/SyncAddressables.cs:120)
spawner.FixedUpdate () (at Assets/spawner.cs:35)

Repro:

    if (m_Counter == 10)
      {
        var go = SyncAddressables.Instantiate("Cube");
        go.transform.forward = new Vector3(Random.Range(0, 180), Random.Range(0, 180), Random.Range(0, 180));
        m_instances.Add(go);

        go = SyncAddressables.Instantiate("Cube");
        go.transform.forward = new Vector3(Random.Range(0, 180), Random.Range(0, 180), Random.Range(0, 180));
        m_instances.Add(go);
kirstenpilla commented 2 years ago

Hi @twhittaker thanks for reporting this! The SyncAddressables project has been removed from the repository. Addressables now supports synchronous loading https://docs.unity3d.com/Packages/com.unity.addressables@1.19/manual/SynchronousAddressables.html