- Home /
AssetDatabase.CreateAsset randomly fails claiming object has been destroyed
I have started running into an odd error while building a series of asset bundles.
I create a ScriptableObject
based asset using AssetDatabase.CreateAsset
Most of the time it works as expected, but sometimes CreateAsset
fails with the following error:
MissingReferenceException: The object of type 'ActivityBundleManifest' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
where ActivityBundleManifest
is the scriptable object class
I have checked the obvious things:
The object has not been destroyed. I can print out content from it in the line before I try and create it
Its OnDestroy method does not get called here
The path is valid
Unity is not running out of memory (using < 1GB, and system has 8GB free)
The object is created using
ScriptableObject.CreateInstance
I am using Unity 4.6.1 on OS X.
Does anyone have any clues as to why this is occurring?
I'm running into the same issue in 5.1.1f1 on Windows 7. It also only happens about 5% of the time.
Your answer
Follow this Question
Related Questions
Getting Reference to Asset without calling LoadAsset 0 Answers
Converting XML-files into assets 1 Answer
I can't find my scriptable object though I've creat asset menu... 1 Answer
Addressables - Use Asset Database (faster) - Not loading assets within a folder 1 Answer
RenameAsset does not change the name of asset in Project Window in Awake() or OnEnable() 1 Answer