From f1106c36ff6aa9be443add9512c121c54b74a3cd Mon Sep 17 00:00:00 2001 From: Weicao-CatilGrass <1992414357@qq.com> Date: Mon, 1 Jun 2026 14:03:14 +0800 Subject: 重新排列测试场景 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/FragmentRequire.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'Assets/Scripts') diff --git a/Assets/Scripts/FragmentRequire.cs b/Assets/Scripts/FragmentRequire.cs index 4b0ab30..f0099b6 100644 --- a/Assets/Scripts/FragmentRequire.cs +++ b/Assets/Scripts/FragmentRequire.cs @@ -1,8 +1,6 @@ -using System; using System.Collections.Generic; using UnityEditor; using UnityEngine; -using UnityEngine.SceneManagement; [RequireComponent(typeof(BoxCollider))] [ExecuteAlways] @@ -41,9 +39,20 @@ public class FragmentRequire : MonoBehaviour var size = new Vector3(cs.x * ts.x, cs.y * ts.y, cs.z * ts.z); Gizmos.matrix = transform.localToWorldMatrix; - Gizmos.color = new Color(1f, 0.18f, 0.29f, 0.1f); - Gizmos.DrawCube(_boxCollider.center, size); Gizmos.color = new Color(1f, 0.18f, 0.29f); Gizmos.DrawWireCube(_boxCollider.center, size); } + + private void OnDrawGizmosSelected() + { + if (_boxCollider == null) return; + + var cs = _boxCollider.size; + var ts = Vector3.one; + var size = new Vector3(cs.x * ts.x, cs.y * ts.y, cs.z * ts.z); + + Gizmos.matrix = transform.localToWorldMatrix; + Gizmos.color = new Color(1f, 0.18f, 0.29f, 0.4f); + Gizmos.DrawCube(_boxCollider.center, size); + } } -- cgit