//获取设置文件 QuadtreeSetting GetSettingObject(string settingObjectName) { QuadtreeSetting settingObject = LoadSetting(settingObjectName); if (settingObject != null) { return(settingObject); } return(CreatSettingObject(settingObjectName)); }
QuadtreeSetting CreatSettingObject(string settingObjectName) { string settingScriptFilePath = GetSettingScriptFilePath(); if (!AssetDatabase.IsValidFolder(settingScriptFilePath + "Resources")) { CreatResourcesFolder(settingScriptFilePath); } QuadtreeSetting settingObject = CreateInstance <QuadtreeSetting>(); AssetDatabase.CreateAsset(settingObject, settingScriptFilePath + "Resources/" + settingObjectName + ".asset"); return(settingObject); }
//初始化 private void Awake() { QuadtreeSetting setting = Resources.Load <QuadtreeSetting>("QuadtreeSetting"); _quadtree = new QuadtreeData <GameObject>(setting.startTop, setting.startRight, setting.startBottom, setting.startLeft, setting.maxLeafsNumber, setting.minSideLength); }