Skip to content

Commit

Permalink
MD:使GoWrapper加载的GameObject支持PaintMode
Browse files Browse the repository at this point in the history
通过在设置GoWrapper的layer时, 顺带设置GameObject的layer, 使得CaptureCamera能渲染GameObject
  • Loading branch information
lifd committed Mar 30, 2022
1 parent 44af687 commit a5dc31c
Show file tree
Hide file tree
Showing 2 changed files with 21 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
20 changes: 20 additions & 0 deletions Assets/Scripts/Core/GoWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,26 @@ public void SetWrapTarget(GameObject target, bool cloneMaterial)
}
}

override internal void _SetLayerDirect(int value)
{
if (_paintingMode > 0)
{
paintingGraphics.gameObject.layer = value;

}
else
{
gameObject.layer = value;
{
_wrapTarget.layer = value;
foreach (Transform tf in _wrapTarget.GetComponentInChildren<Transform>())
{
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 a5dc31c

Please sign in to comment.