Skip to content

Commit

Permalink
Merge pull request fairygui#180 from lfd547/master
Browse files Browse the repository at this point in the history
MD:使GoWrapper加载的GameObject支持PaintMode
  • Loading branch information
xiaoguzhu authored Mar 15, 2024
2 parents 989e82f + 0d013b2 commit 9ac6da8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Assets/Scripts/Core/DisplayObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,7 @@ virtual protected bool SetLayer(int value, bool fromParent)
return true;
}

internal void _SetLayerDirect(int value)
virtual internal void _SetLayerDirect(int value)
{
if (_paintingMode > 0)
paintingGraphics.gameObject.layer = value;
Expand Down
18 changes: 18 additions & 0 deletions Assets/Scripts/Core/GoWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,24 @@ public void SetWrapTarget(GameObject target, bool cloneMaterial)
}
}

override internal void _SetLayerDirect(int value)
{
if (_paintingMode > 0)
paintingGraphics.gameObject.layer = value;
else
{
gameObject.layer = value;
if (_wrapTarget != null)//这个if是为了在GoWrapper里使用模糊效果
{
_wrapTarget.layer = value;
foreach (Transform tf in _wrapTarget.GetComponentsInChildren<Transform>(true))
{
tf.gameObject.layer = value;
}
}
}
}

/// <summary>
/// GoWrapper will cache all renderers of your gameobject on constructor.
/// If your gameobject change laterly, call this function to update the cache.
Expand Down

0 comments on commit 9ac6da8

Please sign in to comment.