I’m using this code to test the differences between Instantiate and InstantiateAsync:
GameObject go = Instantiate(prefab, transform);
go.name = "Instantiate Result";
var async = InstantiateAsync(prefab, transform);
async.completed += operation => {
GameObject go = async.Result[0];
go.name = "Instantiate Async Result";
};
My prefab is fairly complicated with custom serializable dictionaries (using ISerializationCallbackReceiver) and many meshes (added to the prefab asset). Using Instantiate works perfectly; using InstantiateAsync does not:
The async result does not copy the serializable dictionaries from the prefab. By putting in debug prints in OnBeforeSerialize() and OnAfterDeserialize(), I see that only OnBeforeSerialize() is called when InstantiateAsync is used (Instantiate calls both properly). I can work around this by manually calling OnAfterDeserialize() on every serializable dictionary, but that’s not ideal.
My prefab has GameObjects with LOD Groups that use the GameObject’s LOD children as Mesh Renderers. Instantiate properly links the renderers to the LOD children, but the async result still links the renderers to the LOD children in the prefab asset (which is in an Addressable, which you can see in the screenshot). This would not be easy to make a workaround for since my prefabs have many GameObjects with LOD Groups that would need to be reconnected to their LOD children at runtime.