From 5c8859b83ad1fb12cb366e526baa07d8d455b24b Mon Sep 17 00:00:00 2001 From: ousttrue Date: Wed, 13 Jan 2021 13:27:21 +0900 Subject: [PATCH] enabled = false --- .../VRM/Runtime/FirstPerson/VRMFirstPerson.cs | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs b/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs index 470b00f20..050e4b191 100644 --- a/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs +++ b/Assets/VRM/Runtime/FirstPerson/VRMFirstPerson.cs @@ -240,7 +240,7 @@ namespace VRM List m_headlessMeshes = new List(); /// - /// 対象の renderer の可視性を設定する + /// Set target renderer visibility /// /// https://github.com/vrm-c/UniVRM/issues/633#issuecomment-758454045 /// @@ -250,39 +250,47 @@ namespace VRM /// other camera visibility public delegate void SetVisiblityFunc(Renderer renderer, bool firstPerson, bool thirdPerson); + /// + /// Default implementation. + /// Threre are 4 cases. + /// + /// + /// + /// public static void SetVisiblity(Renderer renderer, bool firstPerson, bool thirdPerson) { SetupLayers(); if (firstPerson && thirdPerson) { - // both - // 何もしない - //x.Renderer.gameObject.layer = 0; + // both + // do nothing } else if (firstPerson) { + // only first person renderer.gameObject.layer = FIRSTPERSON_ONLY_LAYER; } else if (thirdPerson) { + // only third person renderer.gameObject.layer = THIRDPERSON_ONLY_LAYER; } else { // invisible - GameObject.Destroy(renderer); + renderer.enabled = false; } } public void Setup() { - // デフォルトの挙動。 v0.63.x までと同じ + // same as v0.63.2 Setup(true, SetVisiblity); } /// - /// この GameObject の子孫の可視性を設定する。 from v0.64.0 + /// from v0.64.0 /// /// public void Setup(bool isSelf, SetVisiblityFunc setVisiblity)