I'm on 2018.2.0x-ImprovedPrefabs I have .asset (ScriptableObject) addressed as "GameSettings". I try loading it this way: Code (CSharp): GameSettings = Addressables.LoadAsset<GameSettings>("GameSettings").Result; The result is always null. The same applies to any other type of object I try to load.
The LoadAsset call is asynchronous (along with all calls in Addressables), so you must wait for the completed callback, and then get the Result. Thanks for trying out the system, please let us know of any other issues, Bill
Is there a way to synchronously load the assets? IE Blocking? Async is all well and good when needed but horrendously complicates code when not. I'm trying to convert over an editor based tool and it is getting very complex and confusing to try and shoehorn async loading into things.
There's an excellent reply from @unity_bill about the difficulties with sync loading that might be worth reading: https://forum.unity.com/threads/my-addressables-feedback.537610/#post-3575862 I'm also wondering what's the recommended way of blocking until the asset is loaded. For system parts that should be loaded at startup, I can think of using a preloading routine that will request the assets and wait in a co-routine until they are loaded, before loading the rest of the system. That's what I already do currently, with scenes and bundles. For everyday references, I'm not sure what's the current recommended way. We can easily fall into callback hell due to the added complexity of async and dependencies.
Well the largest problem I am dealing with is the archetecture of the tool was never designed to be anything but synchronous. The only reason I want to use addressables in the first place is to avoid the problem of GUIDs being an insufficient method of tracking asset connections. This new system will let us track assets by an asset path rather than a GUID. Can I even use coroutines in editor scripts?
There are a few solutions to use coroutines in Editor scripts. For example: https://github.com/marijnz/unity-editor-coroutines If you use UniRx, it already has its own handling of this that you can use without anything extra.