private static void ClearSetting() { DirectoryInfo directoryInfo = new DirectoryInfo(LUNCH_SETTING_PATH); if (!directoryInfo.Exists) { directoryInfo.Create(); } AssetDatabase.DeleteAsset(LUNCH_SETTING_FILE_PATH); _instance = null; }
private static LaunchSetting CreateSettingForce() { DirectoryInfo directoryInfo = new DirectoryInfo(LUNCH_SETTING_PATH); if (!directoryInfo.Exists) { directoryInfo.Create(); } LaunchSetting setting = CreateInstance <LaunchSetting>(); AssetDatabase.CreateAsset(setting, LUNCH_SETTING_FILE_PATH); return(setting); }
private static LaunchSetting FindBuildProjectSetting() { LaunchSetting result = null; // Resources.FindObjectsOfTypeAll查找该类型的所有对象 // 这个函数可以返回加载的Unity物体的任意类型,包含游戏对象、预制体、材质、网格、纹理等等 LaunchSetting[] buildProjectSettings = Resources.FindObjectsOfTypeAll <LaunchSetting>(); if (buildProjectSettings != null && buildProjectSettings.Length > 0) { result = buildProjectSettings[0]; } if (!result) { result = AssetDatabase.LoadAssetAtPath <LaunchSetting>(LUNCH_SETTING_FILE_PATH); } return(result); }