using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
public class ChangeLOD : Editor
{
[MenuItem("Assets/ChangeLODSetting")]
public static void OnChangeLODSetting()
{
GameObject[] gameObjects = Selection.gameObjects;
for(int i = 0; i < gameObjects.Length; i++)
{
LODGroup lodgroup= gameObjects[i].GetComponent<LODGroup>();
if (lodgroup != null)
{
LOD[] lODs = lodgroup.GetLODs();
LOD lod = lODs[lODs.Length - 1];
lod.screenRelativeTransitionHeight = 0.01f;
lODs[lODs.Length - 1] = lod;
lodgroup.SetLODs(lODs);
lodgroup.RecalculateBounds();
string assetPath = AssetDatabase.GetAssetPath(gameObjects[i]);
Debug.Log(assetPath);
PrefabUtility.SavePrefabAsset(gameObjects[i]);
}
}
}
}
LOD自动修改工具
最新推荐文章于 2024-05-13 09:36:20 发布