Skip to content

Commit

Permalink
perf: UserLogicでエラーが起こった際にそれ以降の処理をスキップさせるようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
pspkurara committed Sep 16, 2020
1 parent 8e37be3 commit f98ecd3
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion Packages/uGUI-Skinner/Runtime/SkinParts/ScriptableLogic.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;

namespace Pspkurara.UI.Skinner
{

Expand All @@ -16,13 +18,16 @@ internal sealed class Logic : ISkinLogic

UserLogic userLogic;
SkinPartsPropertry ignoredLogicProperty;
bool catchedError;

/// <summary>
/// 値をオブジェクトに反映させる
/// </summary>
/// <param name="property">プロパティ</param>
public void SetValues(SkinPartsPropertry property)
{
// エラー出るようなら何もしてほしくない
if (catchedError) return;
//値がないなら何もしない
if (property.objectReferenceValues.Count < RequiredObjectLength) return;
if (!userLogic)
Expand All @@ -37,7 +42,17 @@ public void SetValues(SkinPartsPropertry property)
ignoredLogicProperty.objectReferenceValues.Remove(userLogic);
}
UserLogicExtension.SetActiveUserLogic(userLogic);
userLogic.SetValues(ignoredLogicProperty);
// 自由に処理をかけるのでエラー回避を入れておく
try
{
userLogic.SetValues(ignoredLogicProperty);
}
// エラーが起こっても何もせず終わる
catch (Exception)
{
// フラグ立ててそれ以上処理不要にする
catchedError = true;
}
UserLogicExtension.ReleaseActiveUserLogic();
}

Expand Down

0 comments on commit f98ecd3

Please sign in to comment.