[fix] 解决编辑器打包时出现的 _serializedObject.targetObject 意外销毁的情况 (#17)

main
雨落随风 2022-11-02 17:54:46 +08:00 committed by GitHub
parent 3918b707e3
commit 689e582efd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -115,6 +115,11 @@ namespace HybridCLR.Editor
{ {
using (CreateSettingsWindowGUIScope()) using (CreateSettingsWindowGUIScope())
{ {
//解决编辑器打包时出现的 _serializedObject.targetObject 意外销毁的情况
if (_serializedObject == null||!_serializedObject.targetObject)
{
InitGUI();
}
_serializedObject.Update(); _serializedObject.Update();
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
EditorGUILayout.PropertyField(_enable); EditorGUILayout.PropertyField(_enable);