- Home /
Unable to load asset at path with unity tutorial code
I'm trying to use the following tutorial to get a better understanding of creating editor interfaces in unity and loading custom assets: https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/scriptable-objects
I'm currently only focusing on the latter part of the tutorial which involves creating a simple editor for an inventory system. I've copied everything from the tutorial verbatim into my project and have been able create and edit new inventory list assets. However, when I reload the editor and open the saved inventory item list, the function AssetDatabase.LoadAssetAtPath(...) returns null and is unable load the inventory list. I have checked that the actual asset does exist on the disk.
Also, since I have simply copied and pasted the tutorial into my project, I would expect that this should be working unless something has changed in asset loading/save in unity since the tutorial was created.
Are there any steps that may be missing in the tutorial that I need to following for asset loading? Is there anyway to retrieve information on why AssetDatabase.LoadAssetAtPath failed to load?
Edit: I notice that on load, the assets are not able to be edited by clicking on them in the content browser. They have the following error being displayed: "The associated script can not be loaded. Please fix any compile errors and assign a valid script."
I noticed if I recompile/touch the InventoryItemList.cs then it appears that the asset loads properly. Any idea what this could be?
Answer by Epenetus · Apr 17, 2017 at 07:18 PM
I ended up being able to fix the issue. It appears that I needed to have each scriptable object class have it's own .cs file. I found this by forcing serialization to be text and noticing that the script GUID were null.