コード例 #1
0
        protected override void OnSceneGUI()
        {
            if (!(GraphicsSettings.currentRenderPipeline is UniversalRenderPipelineAsset))
            {
                return;
            }

            if (!(target is Light light) || light == null)
            {
                return;
            }

            switch (light.type)
            {
            case LightType.Spot:
                using (new Handles.DrawingScope(Matrix4x4.TRS(light.transform.position, light.transform.rotation, Vector3.one)))
                {
                    CoreLightEditorUtilities.DrawSpotLightGizmo(light);
                }
                break;

            case LightType.Point:
                using (new Handles.DrawingScope(Matrix4x4.TRS(light.transform.position, Quaternion.identity, Vector3.one)))
                {
                    CoreLightEditorUtilities.DrawPointLightGizmo(light);
                }
                break;

            case LightType.Rectangle:
                using (new Handles.DrawingScope(Matrix4x4.TRS(light.transform.position, light.transform.rotation, Vector3.one)))
                {
                    CoreLightEditorUtilities.DrawRectangleLightGizmo(light);
                }
                break;

            case LightType.Disc:
                using (new Handles.DrawingScope(Matrix4x4.TRS(light.transform.position, light.transform.rotation, Vector3.one)))
                {
                    CoreLightEditorUtilities.DrawDiscLightGizmo(light);
                }
                break;

            case LightType.Directional:
                using (new Handles.DrawingScope(Matrix4x4.TRS(light.transform.position, light.transform.rotation, Vector3.one)))
                {
                    CoreLightEditorUtilities.DrawDirectionalLightGizmo(light);
                }
                break;

            default:
                base.OnSceneGUI();
                break;
            }
        }