I am currently trying to better understand Unity techniques by means of an example project.
The project is designed so that many scenes are bundled into AssetBundles.
At one point, when it comes to addressable assets and scriptable objects, I don’t understand why different approaches are chosen in the example.
The author links the AddressableObject sometimes as AssetReference, which has to be loaded async, but sometimes also as a diect reference.
My question is therefore: What difference could there be between the following situations:
[SerializeField] private AssetReference mySOAssetReference;
private void DoSomething()
{
mySOAssetReference.LoadAssetAsync().Completed += (mySO) => {
myAsset.Result.DoItNow();
}
}
V.S.
[SerializeField] private MyScripableObject mySO;
private void DoSomething()
{
mySO.DoItNow();
}
By the way: It’s about the former Unity Open Project “Chop Chop”. The author uses this procedure to exchange events between several scenes. In the initialisation scene the event is loaded as AssetReference, but in the scene “PersistenceManagers” the same ScriptableObject is accessed via direct reference.