- Home /
Building Game w/ Scriptable Objects
In my game I'm using scriptable objects to hold the game skills and game items. When I try to reference them after building and running, there's a null reference. Here's the code I'm using:
GameItemList itemsList = (GameItemList)Resources.LoadAssetAtPath ("Assets/Resources/Lists/GameItemList.asset",typeof(GameItemList));
It works fine in the editor, but not outside of it. What could the problem possibly be?
Answer by Graham-Dunnett · Jun 28, 2014 at 05:50 PM
It doesn't work outside of the editor because the function you use is documented as only working in the editor, see:
http://docs.unity3d.com/ScriptReference/Resources.LoadAssetAtPath.html
Maybe you meant to use Resources.Load()
?
Now I'm receiving the following error when I build the game:
An asset is marked with HideFlags.DontSave but is included in the build:
Asset: 'Assets/Resources/Lists/GameSkillList.asset'
Your answer
Follow this Question
Related Questions
MonoDevelop Unhandled Exception. MonoDevelop will now close - Mac OSX 1 Answer
A node in a childnode? 1 Answer
Unity Player has crashed 1 Answer
NullReferenceExeption: Object reference not set to an instance of an object. 1 Answer
[CLOSED] 2 errors but i don't know exactly (including picture) 2 Answers