您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
39 行
902 B
39 行
902 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
using System;
|
|
|
|
[InitializeOnLoad]
|
|
public class LodSelector
|
|
{
|
|
static bool enabled = false;
|
|
|
|
static LodSelector()
|
|
{
|
|
EditorApplication.update -= CheckSelected;
|
|
EditorApplication.update += CheckSelected;
|
|
}
|
|
|
|
[MenuItem("A2/Hotkeys/LodSelector &L")]
|
|
static void ToggleLodSelector()
|
|
{
|
|
enabled = !enabled;
|
|
Debug.Log("Lod selection hackery is: " + (enabled ? "enabled" : "disabled"));
|
|
}
|
|
|
|
private static void CheckSelected()
|
|
{
|
|
if (!enabled)
|
|
return;
|
|
|
|
if (Selection.transforms.Length != 1)
|
|
return;
|
|
|
|
var t = Selection.transforms[0];
|
|
if (t.parent != null && t.parent.GetComponent<LODGroup>() != null)
|
|
{
|
|
Selection.activeGameObject = t.parent.gameObject;
|
|
}
|
|
}
|
|
}
|