111
This commit is contained in:
8
Assets/ThirdParty/Tools/SetLodGroup/Editor.meta
vendored
Normal file
8
Assets/ThirdParty/Tools/SetLodGroup/Editor.meta
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab4f6500584d60e40b1e38f9294a1a7c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
72
Assets/ThirdParty/Tools/SetLodGroup/Editor/SetLodGroupEditor.cs
vendored
Normal file
72
Assets/ThirdParty/Tools/SetLodGroup/Editor/SetLodGroupEditor.cs
vendored
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/Tools/SetLodGroup/Editor/SetLodGroupEditor.cs.meta
vendored
Normal file
11
Assets/ThirdParty/Tools/SetLodGroup/Editor/SetLodGroupEditor.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eac2d23c344733c42897d7e65b5cfc7d
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
21
Assets/ThirdParty/Tools/SetLodGroup/SetLodGroup.cs
vendored
Normal file
21
Assets/ThirdParty/Tools/SetLodGroup/SetLodGroup.cs
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class SetLodGroup : MonoBehaviour
|
||||
{
|
||||
public GameObject root;
|
||||
public LODGroup lODGroup;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
11
Assets/ThirdParty/Tools/SetLodGroup/SetLodGroup.cs.meta
vendored
Normal file
11
Assets/ThirdParty/Tools/SetLodGroup/SetLodGroup.cs.meta
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d5117892e741aa47bca5c7a2dc7511a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user