Skip to content

Commit

Permalink
fix: ScriptableLogic インスペクターでロジック差し替え時に発生するエラーを修正
Browse files Browse the repository at this point in the history
  • Loading branch information
pspkurara committed Sep 9, 2020
1 parent 122bd13 commit b1f0919
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ public void CleanupFields(EditorSkinPartsPropertry property)

public void DrawInspector(EditorSkinPartsPropertry property)
{
var p = property.objectReferenceValues.GetArrayElementAtIndex(ScriptableLogic.LogicIndex);
SkinnerEditorUtility.ResetArray(property.objectReferenceValues, ScriptableLogic.RequiredObjectLength, false);

var logicProperty = property.objectReferenceValues.GetArrayElementAtIndex(ScriptableLogic.LogicIndex);
Expand All @@ -97,7 +96,15 @@ public void DrawInspector(EditorSkinPartsPropertry property)
{
EditorGUI.showMixedValue = true;
}
var preSelectLogic = logicProperty.objectReferenceValue as UserLogic;
logicProperty.objectReferenceValue = EditorGUILayout.ObjectField(SkinContent.Logic, logicProperty.objectReferenceValue, typeof(UserLogic), false);
// このタイミングで参照対象が変わるとエラーが起こる
if (preSelectLogic != logicProperty.objectReferenceValue)
{
// クリーンアップしてインスペクターは次に描画させる
CleanupFields(property);
return;
}
EditorGUI.showMixedValue = showMixedValue;

if (logicProperty.hasMultipleDifferentValues) return;
Expand Down

0 comments on commit b1f0919

Please sign in to comment.