This commit is contained in:
2025-11-14 18:44:06 +08:00
parent 10156da245
commit 22e867d077
7013 changed files with 2572882 additions and 1804 deletions

View File

@@ -0,0 +1,72 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(SetLodGroup))]
public class SetLodGroupEditor : Editor
{
SetLodGroup inst;
private void OnEnable()
{
inst = (SetLodGroup)target;
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
//
if(GUILayout.Button("SetLodGroup", GUILayout.Height(50)))
{
ASDASD();
}
}
void asdasdasda()
{
foreach (Transform t in inst.root.GetComponentInChildren<Transform>())
{
if (t.childCount > 0)
{
foreach (Transform tt in t.GetComponentInChildren<Transform>())
{
tt.gameObject.SetActive(true);
tt.GetComponent<MeshRenderer>().enabled = false;
}
t.GetChild(0).GetComponent<MeshRenderer>().enabled = true;
}
}
}
void ASDASD()
{
foreach (Transform t in inst.root.GetComponentInChildren<Transform>())
{
Debug.Log(t.name +" "+ t.childCount);
if (t.childCount > 0)
{
if (t.gameObject.GetComponent<LODGroup>())
{
DestroyImmediate(t.gameObject.GetComponent<LODGroup>());
}
//
LODGroup lodGroup = t.gameObject.AddComponent<LODGroup>();
LOD[] lods = inst.lODGroup.GetLODs();
for (int i = 0; i < lods.Length; ++i)
{
lods[i].renderers = new Renderer[] { t.GetChild(i).GetComponent<Renderer>() };
}
lodGroup.SetLODs(lods);
lodGroup.RecalculateBounds();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: eac2d23c344733c42897d7e65b5cfc7d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: