diff options
| author | Weicao-CatilGrass <1992414357@qq.com> | 2026-06-01 14:03:14 +0800 |
|---|---|---|
| committer | Weicao-CatilGrass <1992414357@qq.com> | 2026-06-01 14:03:14 +0800 |
| commit | f1106c36ff6aa9be443add9512c121c54b74a3cd (patch) | |
| tree | fd6a88b5af643cccb94d34306e94ea8756297681 /Assets/Scripts/FragmentRequire.cs | |
| parent | ff1e4698f877ead17ee723ff465f26fad58cd0a0 (diff) | |
重新排列测试场景
Diffstat (limited to 'Assets/Scripts/FragmentRequire.cs')
| -rw-r--r-- | Assets/Scripts/FragmentRequire.cs | 17 |
1 files changed, 13 insertions, 4 deletions
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); + } } |
