Crash when reimporting custom assets
So, I'm getting this problem when trying to refresh my custom assets in order to update their preview images(supposedly, I have managed to make them use a sprite as a thumbnail, instead of just that bland Unity icon). But then I get this:
Updating Assets/Data/Zodiac/Aries.asset - GUID: 459b678aa6ed74dd295a351c1c9b3c6d...
done. [Time: 95,047000 ms]
Assertion failed on expression: 'm_InstanceID != InstanceID_None'
(Filename: /home/builduser/buildslave/unity/build/Runtime/BaseClasses/BaseObject.h Line: 391)
Assertion failed on expression: 'Object::ms_IDToPointer->find(object->GetInstanceID()) != Object::ms_IDToPointer->end()'
(Filename: /home/builduser/buildslave/unity/build/Runtime/BaseClasses/BaseObject.cpp Line: 376)
Assertion failed on expression: 'm_InstanceID != InstanceID_None'
(Filename: /home/builduser/buildslave/unity/build/Runtime/BaseClasses/BaseObject.h Line: 391)
Assertion failed on expression: 'm_InstanceID != InstanceID_None'
(Filename: /home/builduser/buildslave/unity/build/Runtime/BaseClasses/BaseObject.h Line: 391)
Receiving unhandled NULL exception
#0 0x007fffef0545c0 in funlockfile
#1 0x007fffef054b78 in remove_free_block
#2 0x007fffef054b80 in block_remove
#3 0x007fffef054ba8 in block_merge_next
#4 0x007fffef054bc0 in tlsf_free
#5 0x007fffef054be0 in DynamicHeapAllocator<LowLevelAllocator>::TryDeallocate(void*)
#6 0x007fffef054c20 in DualThreadAllocator<DynamicHeapAllocator<LowLevelAllocator> >::TryDeallocate(void*)
#7 0x007fffef054c40 in MemoryManager::Deallocate(void*, MemLabelId const&)
#8 0x007fffef054cd0 in dynamic_array<TextRenderingPrivate::FontImpl::CharacterInfo, 4ul>::deallocate()
#9 0x007fffef054cf0 in dynamic_array<TextRenderingPrivate::FontImpl::CharacterInfo, 4ul>::clear()
#10 0x007fffef054d00 in TextRenderingPrivate::FontImpl::ResetCachedTexture()
#11 0x007fffef054e00 in TextRenderingPrivate::FontImpl::AwakeFromLoadImpl(AwakeFromLoadMode)
#12 0x007fffef054ea0 in AssetInterface::StopAssetEditing(CancelBehaviour, AssetDatabase::UpdateAssetOptions)
#13 0x007fffef055010 in AssetInterface::ImportAssets(std::set<UnityGUID, std::less<UnityGUID>, std::allocator<UnityGUID> > const&, AssetDatabase::UpdateAssetOptions)
#14 0x007fffef055080 in AssetsMenu::Execute(MenuItem const&)
#15 0x007fffef055250 in MenuController::ExecuteMenuItem(MenuItem&, MenuController::ExecutionCause)
#16 0x007fffef0552e0 in OnActivated(MenuItem*)
#17 0x007fffef055340 in g_closure_invoke
#18 0x007fffef0553b0 in g_signal_handler_disconnect
#19 0x007fffef055500 in g_signal_emit_valist
#20 0x007fffef0556b0 in g_signal_emit
#21 0x007fffef055790 in gtk_widget_activate
#22 0x007fffef0557b0 in gtk_menu_shell_activate_item
#23 0x007fffef0557e0 in gtk_menu_shell_activate_item
#24 0x007fffef055860 in gtk_marshal_VOID__UINT_STRING
#25 0x007fffef055890 in g_closure_invoke
#26 0x007fffef055900 in g_signal_handler_disconnect
#27 0x007fffef055a50 in g_signal_emit_valist
#28 0x007fffef055c10 in g_signal_emit
#29 0x007fffef055cf0 in gtk_widget_translate_coordinates
#30 0x007fffef055d30 in gtk_propagate_event
#31 0x007fffef055d60 in gtk_main_do_event
#32 0x007fffef055db0 in gdk_event_get_graphics_expose
#33 0x007fffef055dc0 in g_main_context_dispatch
#34 0x007fffef055e50 in g_main_context_dispatch
#35 0x007fffef055eb0 in g_main_loop_run
#36 0x007fffef055ee0 in gtk_main
#37 0x007fffef055f60 in main
#38 0x007fffef056390 in __libc_start_main
#39 0x007fffef056450 in _start
Launching bug reporter
/home/builduser/buildslave/unity/build/Editor/Platform/Linux/UsbDevices.cpp:UsbDevicesQuery
/home/builduser/buildslave/unity/build/Editor/Platform/Linux/UndoPlatformDependent.cpp:SetUndoMenuNamePlatformDependent
/home/builduser/buildslave/unity/build/Editor/Platform/Linux/UndoPlatformDependent.cpp:SetUndoMenuNamePlatformDependent
/home/builduser/buildslave/unity/build/Editor/Platform/Linux/UndoPlatformDependent.cpp:SetUndoMenuNamePlatformDependent
/home/builduser/buildslave/unity/build/Editor/Platform/Linux/UndoPlatformDependent.cpp:SetUndoMenuNamePlatformDependent
/home/builduser/buildslave/unity/build/Editor/Platform/Linux/UndoPlatformDependent.cpp:SetUndoMenuNamePlatformDependent
I'm lost, trying to add some null checks here and there to see if I can catch this null pointer exception... so far, to no avail. Any clue?
UPDATE: I got somewhere, but still lost. But, at least, Unity isn't crashing now.
This is the code I'm using to set custom thumbnails on my assets. Basically I'm picking a Sprite member of this asset and using it as the image:
[CustomEditor(typeof(ZodiacFaction))]
[CanEditMultipleObjects]
public class ZodiacFactionEditor: Editor {
public override Texture2D RenderStaticPreview(string assetPath, Object[] subAssets, int width, int height) {
ZodiacFaction zTarget = (ZodiacFaction) target;
Sprite zodiacSprite = zTarget.GetEmblem();
return zodiacSprite.texture;
}
}
But, when debugging, I see that, for some reason the texture member of the sprite is coming up null. Not the sprite itself, the texture. So this is what's causing the Assertion failure, apparently. I'm still on the dark as to why these sprites are turning out null, but... it's more clear now, at least.
Your answer
Follow this Question
Related Questions
Unity Editor crashes when pressing play (2017.2.0f3 64bit) 2 Answers
Editor crashes when opening project (fresh install) 1 Answer
Editor Script Causes Crash. 0 Answers
Why does UnityAds crash my game after I close the ad? 0 Answers
Making Node editor but having problem with passing through non static data to static method 0 Answers