From 4d2c769f0be2f6be16b4ce8c7fa53d93216ef499 Mon Sep 17 00:00:00 2001 From: matsutaka Date: Wed, 24 Jun 2026 17:17:40 +0900 Subject: [PATCH 1/6] =?UTF-8?q?fix:=20VRM10=20-=20Unity=206.5=20=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TreeViewをTreeViewに変更 - GetInstanceID()をGetEntityId()に置き換え - 上記の受け型もintからEntityIdに変更 - Handles.SphereHandleCap()等の第一引数 control id をコンポーネントから取得する関数を追加 --- .../Components/SpringBone/SelectedGUI.cs | 14 ++++++++++ .../SpringBone/SpringBoneTreeView.cs | 26 +++++++++++++------ .../MorphTargetIdentifier.cs | 24 +++++++++++++++++ .../SpringBone/VRM10SpringBoneCollider.cs | 6 +++++ 4 files changed, 62 insertions(+), 8 deletions(-) diff --git a/Packages/VRM10/Editor/Components/SpringBone/SelectedGUI.cs b/Packages/VRM10/Editor/Components/SpringBone/SelectedGUI.cs index 6eee18938..9185d149d 100644 --- a/Packages/VRM10/Editor/Components/SpringBone/SelectedGUI.cs +++ b/Packages/VRM10/Editor/Components/SpringBone/SelectedGUI.cs @@ -81,10 +81,24 @@ namespace UniVRM10 if (isFocused) { + bool refresh = false; +#if UNITY_6000_5_OR_NEWER + var id = element.objectReferenceValue.GetEntityId(); + if (id != VRM10SpringBoneCollider.SelectedEntityId) + { + VRM10SpringBoneCollider.SelectedEntityId = id; + refresh = true; + } +#else var id = element.objectReferenceValue.GetInstanceID(); if (id != VRM10SpringBoneCollider.SelectedGuid) { VRM10SpringBoneCollider.SelectedGuid = id; + refresh = true; + } +#endif + if (refresh) + { SceneView.RepaintAll(); EditorUtility.SetDirty(element.objectReferenceValue); } diff --git a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs index 03ec1f6d6..36ad8e644 100644 --- a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs +++ b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs @@ -1,7 +1,11 @@ using System.Collections.Generic; using UnityEditor; -using UnityEditor.IMGUI.Controls; using UnityEngine; +#if UNITY_6000_5_OR_NEWER +using TreeView = UnityEditor.IMGUI.Controls.TreeView; +using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; +using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState; +#endif namespace UniVRM10 { @@ -254,20 +258,20 @@ namespace UniVRM10 { case VRM10SpringBoneColliderTypes.Sphere: // Handles.color = Color.magenta; - Handles.SphereHandleCap(collider.GetInstanceID(), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); + Handles.SphereHandleCap(GetControlId(collider), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); break; case VRM10SpringBoneColliderTypes.Capsule: // Handles.color = Color.cyan; - Handles.SphereHandleCap(collider.GetInstanceID(), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); - Handles.SphereHandleCap(collider.GetInstanceID(), collider.Tail, Quaternion.identity, collider.Radius * 2, Event.current.type); + Handles.SphereHandleCap(GetControlId(collider), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); + Handles.SphereHandleCap(GetControlId(collider), collider.Tail, Quaternion.identity, collider.Radius * 2, Event.current.type); Handles.DrawLine(collider.Offset, collider.Tail); break; } Handles.matrix = Matrix4x4.identity; } - var isHover = HandleUtility.nearestControl == collider.GetInstanceID(); + var isHover = HandleUtility.nearestControl == GetControlId(collider); return (IsLeftDown() && isHover, isHover); } @@ -280,7 +284,7 @@ namespace UniVRM10 { // 先頭 Handles.color = color; - Handles.CubeHandleCap(joint.GetInstanceID(), joint.transform.position, joint.transform.rotation, + Handles.CubeHandleCap(GetControlId(joint), joint.transform.position, joint.transform.rotation, // head の radius joint.m_jointRadius, Event.current.type); } @@ -291,14 +295,20 @@ namespace UniVRM10 Handles.DrawLine(joint.transform.position, head.transform.position); // joint Handles.color = color; - Handles.SphereHandleCap(joint.GetInstanceID(), joint.transform.position, joint.transform.rotation, + Handles.SphereHandleCap(GetControlId(joint), joint.transform.position, joint.transform.rotation, // head の radius head.m_jointRadius * 2, Event.current.type); } } - var isHover = HandleUtility.nearestControl == joint.GetInstanceID(); + var isHover = HandleUtility.nearestControl == GetControlId(joint); return (IsLeftDown() && isHover, isHover); } + +#if UNITY_6000_5_OR_NEWER + static int GetControlId(Component component) => EntityId.ToULong(component.GetEntityId()).GetHashCode(); +#else + static int GetControlId(Component component) => component.GetInstanceID(); +#endif } } diff --git a/Packages/VRM10/Runtime/Components/Expression/MorphTargetBindingMerger/MorphTargetIdentifier.cs b/Packages/VRM10/Runtime/Components/Expression/MorphTargetBindingMerger/MorphTargetIdentifier.cs index 4285d4cd7..febc4b8e0 100644 --- a/Packages/VRM10/Runtime/Components/Expression/MorphTargetBindingMerger/MorphTargetIdentifier.cs +++ b/Packages/VRM10/Runtime/Components/Expression/MorphTargetBindingMerger/MorphTargetIdentifier.cs @@ -23,19 +23,31 @@ namespace UniVRM10 } public SkinnedMeshRenderer TargetRenderer { get; } +#if UNITY_6000_5_OR_NEWER + public EntityId TargetRendererEntityId { get; } +#else public int TargetRendererInstanceId { get; } +#endif public int TargetBlendShapeIndex { get; } public MorphTargetIdentifier(SkinnedMeshRenderer targetRenderer, int targetBlendShapeIndex) { TargetRenderer = targetRenderer; +#if UNITY_6000_5_OR_NEWER + TargetRendererEntityId = targetRenderer.GetEntityId(); +#else TargetRendererInstanceId = targetRenderer.GetInstanceID(); +#endif TargetBlendShapeIndex = targetBlendShapeIndex; } public bool Equals(MorphTargetIdentifier other) { +#if UNITY_6000_5_OR_NEWER + return TargetRendererEntityId == other.TargetRendererEntityId && TargetBlendShapeIndex == other.TargetBlendShapeIndex; +#else return TargetRendererInstanceId == other.TargetRendererInstanceId && TargetBlendShapeIndex == other.TargetBlendShapeIndex; +#endif } public override bool Equals(object obj) @@ -45,7 +57,11 @@ namespace UniVRM10 public override int GetHashCode() { +#if UNITY_6000_5_OR_NEWER + return HashCode.Combine(TargetRendererEntityId, TargetBlendShapeIndex); +#else return HashCode.Combine(TargetRendererInstanceId, TargetBlendShapeIndex); +#endif } #region IEqualityComparer @@ -55,12 +71,20 @@ namespace UniVRM10 { public bool Equals(MorphTargetIdentifier x, MorphTargetIdentifier y) { +#if UNITY_6000_5_OR_NEWER + return x.TargetRendererEntityId == y.TargetRendererEntityId && x.TargetBlendShapeIndex == y.TargetBlendShapeIndex; +#else return x.TargetRendererInstanceId == y.TargetRendererInstanceId && x.TargetBlendShapeIndex == y.TargetBlendShapeIndex; +#endif } public int GetHashCode(MorphTargetIdentifier obj) { +#if UNITY_6000_5_OR_NEWER + return HashCode.Combine(obj.TargetRendererEntityId, obj.TargetBlendShapeIndex); +#else return HashCode.Combine(obj.TargetRendererInstanceId, obj.TargetBlendShapeIndex); +#endif } } #endregion diff --git a/Packages/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs b/Packages/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs index 0685eb687..fa0705879 100644 --- a/Packages/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs +++ b/Packages/VRM10/Runtime/Components/SpringBone/VRM10SpringBoneCollider.cs @@ -30,9 +30,15 @@ namespace UniVRM10 public Vector3 TailOrNormal => ColliderType == VRM10SpringBoneColliderTypes.Plane ? Normal : Tail; +#if UNITY_6000_5_OR_NEWER + public static EntityId SelectedEntityId; + + public bool IsSelected => GetEntityId() == SelectedEntityId; +#else public static int SelectedGuid; public bool IsSelected => GetInstanceID() == SelectedGuid; +#endif public void OnValidate() { From 7496de547ec67e87d85c024eb18b3bc9a9852cfd Mon Sep 17 00:00:00 2001 From: matsutaka Date: Wed, 24 Jun 2026 17:18:05 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix:=20UniGLTF=20-=20Unity=206.5=20?= =?UTF-8?q?=E3=81=A7=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - TreeViewをTreeViewに変更 --- .../UniGLTF/Editor/UniHumanoid/MuscleInspectorEditor.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Packages/UniGLTF/Editor/UniHumanoid/MuscleInspectorEditor.cs b/Packages/UniGLTF/Editor/UniHumanoid/MuscleInspectorEditor.cs index 2c698ddee..dddc37da9 100644 --- a/Packages/UniGLTF/Editor/UniHumanoid/MuscleInspectorEditor.cs +++ b/Packages/UniGLTF/Editor/UniHumanoid/MuscleInspectorEditor.cs @@ -4,6 +4,11 @@ using System.Collections.Generic; using UnityEditor; using UnityEditor.IMGUI.Controls; using UnityEngine; +#if UNITY_6000_5_OR_NEWER +using TreeView = UnityEditor.IMGUI.Controls.TreeView; +using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; +using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState; +#endif namespace UniHumanoid { @@ -183,7 +188,7 @@ namespace UniHumanoid } // inside class BoneTreeView : TreeView - protected override void RowGUI(UnityEditor.IMGUI.Controls.TreeView.RowGUIArgs args) + protected override void RowGUI(RowGUIArgs args) { for (int i = 0; i < args.GetNumVisibleColumns(); ++i) { @@ -191,7 +196,7 @@ namespace UniHumanoid } } - void CellGUI(Rect cellRect, int index, ref UnityEditor.IMGUI.Controls.TreeView.RowGUIArgs args) + void CellGUI(Rect cellRect, int index, ref RowGUIArgs args) { CenterRectUsingSingleLineHeight(ref cellRect); From 11541b5cd31359b9b4312d34efaab65e87544260 Mon Sep 17 00:00:00 2001 From: matsutaka Date: Wed, 24 Jun 2026 17:18:50 +0900 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20VRM10=5FSamples=20-=20Unity=206.5=20?= =?UTF-8?q?=E3=81=A7=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - - Handles.SphereHandleCap()等の第一引数 control id をコンポーネントから取得する関数を追加 --- .../ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs b/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs index c51a2b7ae..5ab4f8919 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs @@ -154,8 +154,13 @@ namespace UniVRM10.ClothWarp.Components p = m_target.GetParticleFromTransform(p.Transform); var t = p.Transform; Handles.color = Color.green; - Handles.SphereHandleCap(t.GetInstanceID(), t.position, t.rotation, p.Settings.Radius * 2, EventType.Repaint); + Handles.SphereHandleCap(GetControlId(t), t.position, t.rotation, p.Settings.Radius * 2, EventType.Repaint); } } +#if UNITY_6000_5_OR_NEWER + static int GetControlId(Component component) => EntityId.ToULong(component.GetEntityId()).GetHashCode(); +#else + static int GetControlId(Component component) => component.GetInstanceID(); +#endif } } \ No newline at end of file From 78ab1af8966d427db942d2d9eccb71089426f75f Mon Sep 17 00:00:00 2001 From: matsutaka Date: Wed, 24 Jun 2026 17:47:11 +0900 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20VRM10=20-=20Unity=206.0=20=E3=81=A7?= =?UTF-8?q?=E3=81=AE=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs index 36ad8e644..ee8bb9c55 100644 --- a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs +++ b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs @@ -5,6 +5,8 @@ using UnityEngine; using TreeView = UnityEditor.IMGUI.Controls.TreeView; using TreeViewItem = UnityEditor.IMGUI.Controls.TreeViewItem; using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState; +#else +using UnityEditor.IMGUI.Controls; #endif namespace UniVRM10 From eb7936bfe56e0a4d25b2bfb0fd10cffc3dbd4f39 Mon Sep 17 00:00:00 2001 From: matsutaka Date: Wed, 24 Jun 2026 18:08:49 +0900 Subject: [PATCH 5/6] =?UTF-8?q?fix:=20=E4=B8=8D=E8=A6=81=E3=81=AAEntityId.?= =?UTF-8?q?ToULong=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs | 2 +- .../VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs b/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs index 5ab4f8919..42caa1362 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs @@ -158,7 +158,7 @@ namespace UniVRM10.ClothWarp.Components } } #if UNITY_6000_5_OR_NEWER - static int GetControlId(Component component) => EntityId.ToULong(component.GetEntityId()).GetHashCode(); + static int GetControlId(Component component) => component.GetEntityId().GetHashCode(); #else static int GetControlId(Component component) => component.GetInstanceID(); #endif diff --git a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs index ee8bb9c55..f20bd5812 100644 --- a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs +++ b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs @@ -308,7 +308,7 @@ namespace UniVRM10 } #if UNITY_6000_5_OR_NEWER - static int GetControlId(Component component) => EntityId.ToULong(component.GetEntityId()).GetHashCode(); + static int GetControlId(Component component) => component.GetEntityId().GetHashCode(); #else static int GetControlId(Component component) => component.GetInstanceID(); #endif From 016e91f6af752fe3550ab4f912747c48554c0041 Mon Sep 17 00:00:00 2001 From: matsutaka Date: Thu, 25 Jun 2026 22:22:59 +0900 Subject: [PATCH 6/6] =?UTF-8?q?GetControlId=E3=82=92extension=E3=81=AB?= =?UTF-8?q?=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/vrm-c/UniVRM/pull/2804#issuecomment-4798507922 による。 将来の変更時に破壊的変更にならないよう、 internal になっている。 結果として、 VRM10_Samples では、独自の定義を行なっている。 --- .../ClothWarp/Editor/ClothWarpRootEditor.cs | 11 +++++++--- .../SpringBone/SpringBoneTreeView.cs | 20 +++++++------------ Packages/VRM10/Editor/Vrm10EditorUtility.cs | 13 ++++++++++++ 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs b/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs index 42caa1362..1df39e720 100644 --- a/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs +++ b/Assets/VRM10_Samples/ClothSample/ClothWarp/Editor/ClothWarpRootEditor.cs @@ -154,13 +154,18 @@ namespace UniVRM10.ClothWarp.Components p = m_target.GetParticleFromTransform(p.Transform); var t = p.Transform; Handles.color = Color.green; - Handles.SphereHandleCap(GetControlId(t), t.position, t.rotation, p.Settings.Radius * 2, EventType.Repaint); + Handles.SphereHandleCap(t.GetControlId(), t.position, t.rotation, p.Settings.Radius * 2, EventType.Repaint); } } + } + + static class ClothWarpRootEditorExtensions + { + internal static int GetControlId(this Component component) #if UNITY_6000_5_OR_NEWER - static int GetControlId(Component component) => component.GetEntityId().GetHashCode(); + => component.GetEntityId().GetHashCode(); #else - static int GetControlId(Component component) => component.GetInstanceID(); + => component.GetInstanceID(); #endif } } \ No newline at end of file diff --git a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs index f20bd5812..0b1e44333 100644 --- a/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs +++ b/Packages/VRM10/Editor/Components/SpringBone/SpringBoneTreeView.cs @@ -260,20 +260,20 @@ namespace UniVRM10 { case VRM10SpringBoneColliderTypes.Sphere: // Handles.color = Color.magenta; - Handles.SphereHandleCap(GetControlId(collider), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); + Handles.SphereHandleCap(collider.GetControlId(), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); break; case VRM10SpringBoneColliderTypes.Capsule: // Handles.color = Color.cyan; - Handles.SphereHandleCap(GetControlId(collider), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); - Handles.SphereHandleCap(GetControlId(collider), collider.Tail, Quaternion.identity, collider.Radius * 2, Event.current.type); + Handles.SphereHandleCap(collider.GetControlId(), collider.Offset, Quaternion.identity, collider.Radius * 2, Event.current.type); + Handles.SphereHandleCap(collider.GetControlId(), collider.Tail, Quaternion.identity, collider.Radius * 2, Event.current.type); Handles.DrawLine(collider.Offset, collider.Tail); break; } Handles.matrix = Matrix4x4.identity; } - var isHover = HandleUtility.nearestControl == GetControlId(collider); + var isHover = HandleUtility.nearestControl == collider.GetControlId(); return (IsLeftDown() && isHover, isHover); } @@ -286,7 +286,7 @@ namespace UniVRM10 { // 先頭 Handles.color = color; - Handles.CubeHandleCap(GetControlId(joint), joint.transform.position, joint.transform.rotation, + Handles.CubeHandleCap(joint.GetControlId(), joint.transform.position, joint.transform.rotation, // head の radius joint.m_jointRadius, Event.current.type); } @@ -297,20 +297,14 @@ namespace UniVRM10 Handles.DrawLine(joint.transform.position, head.transform.position); // joint Handles.color = color; - Handles.SphereHandleCap(GetControlId(joint), joint.transform.position, joint.transform.rotation, + Handles.SphereHandleCap(joint.GetControlId(), joint.transform.position, joint.transform.rotation, // head の radius head.m_jointRadius * 2, Event.current.type); } } - var isHover = HandleUtility.nearestControl == GetControlId(joint); + var isHover = HandleUtility.nearestControl == joint.GetControlId(); return (IsLeftDown() && isHover, isHover); } - -#if UNITY_6000_5_OR_NEWER - static int GetControlId(Component component) => component.GetEntityId().GetHashCode(); -#else - static int GetControlId(Component component) => component.GetInstanceID(); -#endif } } diff --git a/Packages/VRM10/Editor/Vrm10EditorUtility.cs b/Packages/VRM10/Editor/Vrm10EditorUtility.cs index 4df9bfba3..1b7eb3e3d 100644 --- a/Packages/VRM10/Editor/Vrm10EditorUtility.cs +++ b/Packages/VRM10/Editor/Vrm10EditorUtility.cs @@ -51,5 +51,18 @@ namespace UniVRM10 EditorGUI.EndProperty(); } + + /// + /// Control ID を取得 + /// + /// 対象となるコンポーネント + /// コンポーネントの Control ID + /// Control ID とは、Handles.CubeHandleCap()の第一引数等で使用可能な、コンポーネント単位でユニークなint値のこと + internal static int GetControlId(this Component component) +#if UNITY_6000_5_OR_NEWER + => component.GetEntityId().GetHashCode(); +#else + => component.GetInstanceID(); +#endif } } \ No newline at end of file