|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
|
|
namespace uc
|
|
|
|
|
|
{
|
|
|
|
|
|
[InitializeOnLoad]
|
|
|
|
|
|
class StartUpProjectSettingChecker
|
|
|
|
|
|
{
|
|
|
|
|
|
static StartUpProjectSettingChecker()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (ProjectSettingChecker.IsSkipAtStartUp())
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
EditorApplication.delayCall += DelayStartUp;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void DelayStartUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
ProjectSettingChecker.StartUp();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class ProjectSettingChecker : EditorWindow
|
|
|
|
|
|
{
|
|
|
|
|
|
internal class Settings
|
|
|
|
|
|
{
|
|
|
|
|
|
public SerializationMode serializationMode;
|
|
|
|
|
|
public bool runInBackground;
|
|
|
|
|
|
public ApiCompatibilityLevel apiCompatibilityLevel;
|
|
|
|
|
|
public ColorSpace colorSpace;
|
|
|
|
|
|
public ResolutionDialogSetting displayResolutionDialog;
|
|
|
|
|
|
|
|
|
|
|
|
public Settings()
|
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
|
|
public Settings(Settings s)
|
|
|
|
|
|
{
|
|
|
|
|
|
Set(s);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Set(Settings s)
|
|
|
|
|
|
{
|
|
|
|
|
|
serializationMode = s.serializationMode;
|
|
|
|
|
|
runInBackground = s.runInBackground;
|
|
|
|
|
|
apiCompatibilityLevel = s.apiCompatibilityLevel;
|
|
|
|
|
|
colorSpace = s.colorSpace;
|
|
|
|
|
|
displayResolutionDialog = s.displayResolutionDialog;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SaveToProject()
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorSettings.serializationMode = serializationMode;
|
|
|
|
|
|
PlayerSettings.runInBackground = runInBackground;
|
|
|
|
|
|
PlayerSettings.SetApiCompatibilityLevel(BuildTargetGroup.Standalone, apiCompatibilityLevel);
|
|
|
|
|
|
PlayerSettings.colorSpace = colorSpace;
|
|
|
|
|
|
PlayerSettings.displayResolutionDialog = displayResolutionDialog;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void LoadFromProject()
|
|
|
|
|
|
{
|
|
|
|
|
|
serializationMode = EditorSettings.serializationMode;
|
|
|
|
|
|
runInBackground = PlayerSettings.runInBackground;
|
|
|
|
|
|
apiCompatibilityLevel = PlayerSettings.GetApiCompatibilityLevel(BuildTargetGroup.Standalone);
|
|
|
|
|
|
colorSpace = PlayerSettings.colorSpace;
|
|
|
|
|
|
displayResolutionDialog = PlayerSettings.displayResolutionDialog;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool operator ==(Settings s1, Settings s2)
|
|
|
|
|
|
{
|
|
|
|
|
|
return (s1.serializationMode == s2.serializationMode) &&
|
|
|
|
|
|
(s1.runInBackground == s2.runInBackground) &&
|
|
|
|
|
|
(s1.apiCompatibilityLevel == s2.apiCompatibilityLevel) &&
|
|
|
|
|
|
(s1.colorSpace == s2.colorSpace) &&
|
|
|
|
|
|
(s1.displayResolutionDialog == s2.displayResolutionDialog);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static bool operator !=(Settings s1, Settings s2)
|
|
|
|
|
|
{
|
|
|
|
|
|
return !(s1 == s2);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override bool Equals(object other)
|
|
|
|
|
|
{
|
|
|
|
|
|
Settings s = other as Settings;
|
|
|
|
|
|
if (s == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return this == s;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override int GetHashCode()
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const float label_width = 192;
|
|
|
|
|
|
const float row_height = 48;
|
|
|
|
|
|
const float enum_width = 128;
|
|
|
|
|
|
const float btn_recommendation_width = 128;
|
|
|
|
|
|
const float btn_resotre_width = 64;
|
|
|
|
|
|
const float win_width = 660;
|
|
|
|
|
|
const float win_height = 300;
|
|
|
|
|
|
|
|
|
|
|
|
[MenuItem("Window/UC/ProjectSettingChecker _F11")]
|
|
|
|
|
|
internal static void StartUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
ProjectSettingChecker checker = GetWindow<ProjectSettingChecker>(true, "ProjectSettingChecker", true);
|
|
|
|
|
|
checker.minSize = new Vector2(win_width, win_height);
|
|
|
|
|
|
checker.maxSize = checker.minSize;
|
|
|
|
|
|
s_settings_recommendation = new Settings();
|
|
|
|
|
|
s_settings_recommendation.serializationMode = SerializationMode.ForceText;
|
|
|
|
|
|
s_settings_recommendation.runInBackground = true;
|
|
|
|
|
|
#if NET_4_6
|
|
|
|
|
|
s_settings_recommendation.apiCompatibilityLevel = ApiCompatibilityLevel.NET_4_6;
|
|
|
|
|
|
#else
|
|
|
|
|
|
s_settings_recommendation.apiCompatibilityLevel = ApiCompatibilityLevel.NET_2_0;
|
|
|
|
|
|
#endif
|
|
|
|
|
|
s_settings_recommendation.colorSpace = ColorSpace.Linear;
|
|
|
|
|
|
s_settings_recommendation.displayResolutionDialog = ResolutionDialogSetting.Disabled;
|
|
|
|
|
|
|
|
|
|
|
|
checker.mf_Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
internal static bool IsSkipAtStartUp()
|
|
|
|
|
|
{
|
|
|
|
|
|
return s_is_skip_at_start_up;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static Settings s_settings_recommendation;
|
|
|
|
|
|
Settings m_settings_origin;
|
|
|
|
|
|
Settings m_settings_changed;
|
|
|
|
|
|
Settings m_settings_current;
|
|
|
|
|
|
bool m_is_skip_at_startup;
|
|
|
|
|
|
|
|
|
|
|
|
void mf_Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_is_skip_at_startup = s_is_skip_at_start_up;
|
|
|
|
|
|
m_settings_origin = new Settings();
|
|
|
|
|
|
m_settings_origin.LoadFromProject();
|
|
|
|
|
|
m_settings_changed = new Settings(m_settings_origin);
|
|
|
|
|
|
m_settings_current = new Settings(m_settings_origin);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OnGUI()
|
|
|
|
|
|
{
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope("Box", GUILayout.Height(row_height)))
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.LabelField("Asset Serialization Mode", GUILayout.Width(label_width));
|
|
|
|
|
|
m_settings_changed.serializationMode = (SerializationMode)EditorGUILayout.EnumPopup(m_settings_changed.serializationMode, GUILayout.MaxWidth(enum_width));
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_settings_changed.serializationMode != s_settings_recommendation.serializationMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.HelpBox("", MessageType.Warning, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Origin", GUILayout.MaxWidth(btn_resotre_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.serializationMode = m_settings_origin.serializationMode;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Recommendation", GUILayout.MaxWidth(btn_recommendation_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.serializationMode = s_settings_recommendation.serializationMode;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope("Box", GUILayout.Height(row_height)))
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.LabelField("Application Run In Background", GUILayout.Width(label_width));
|
|
|
|
|
|
m_settings_changed.runInBackground = EditorGUILayout.Toggle(m_settings_changed.runInBackground);
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_settings_changed.runInBackground != s_settings_recommendation.runInBackground)
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.HelpBox("", MessageType.Warning, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Origin", GUILayout.Width(btn_resotre_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.runInBackground = m_settings_origin.runInBackground;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Recommendation", GUILayout.Width(btn_recommendation_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.runInBackground = s_settings_recommendation.runInBackground;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope("Box", GUILayout.Height(row_height)))
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.LabelField("Api Compatibility Level", GUILayout.Width(label_width));
|
|
|
|
|
|
m_settings_changed.apiCompatibilityLevel = (ApiCompatibilityLevel)EditorGUILayout.EnumPopup(m_settings_changed.apiCompatibilityLevel, GUILayout.MaxWidth(enum_width));
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_settings_changed.apiCompatibilityLevel != s_settings_recommendation.apiCompatibilityLevel)
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.HelpBox("", MessageType.Warning, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Origin", GUILayout.Width(btn_resotre_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.apiCompatibilityLevel = m_settings_origin.apiCompatibilityLevel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Recommendation", GUILayout.Width(btn_recommendation_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.apiCompatibilityLevel = s_settings_recommendation.apiCompatibilityLevel;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope("Box", GUILayout.Height(row_height)))
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.LabelField("Color Space", GUILayout.Width(label_width));
|
|
|
|
|
|
m_settings_changed.colorSpace = (ColorSpace)EditorGUILayout.EnumPopup(m_settings_changed.colorSpace, GUILayout.MaxWidth(enum_width));
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_settings_changed.colorSpace != s_settings_recommendation.colorSpace)
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.HelpBox("", MessageType.Warning, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Origin", GUILayout.Width(btn_resotre_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.colorSpace = m_settings_origin.colorSpace;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Recommendation", GUILayout.Width(btn_recommendation_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.colorSpace = s_settings_recommendation.colorSpace;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope("Box", GUILayout.Height(row_height)))
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.LabelField("Display Resolution Dialog", GUILayout.Width(label_width));
|
|
|
|
|
|
m_settings_changed.displayResolutionDialog = (ResolutionDialogSetting)EditorGUILayout.EnumPopup(m_settings_changed.displayResolutionDialog, GUILayout.MaxWidth(enum_width));
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
|
|
|
|
|
|
|
|
|
if (m_settings_changed.displayResolutionDialog != s_settings_recommendation.displayResolutionDialog)
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorGUILayout.HelpBox("", MessageType.Warning, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Origin", GUILayout.Width(btn_resotre_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.displayResolutionDialog = m_settings_origin.displayResolutionDialog;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Recommendation", GUILayout.Width(btn_recommendation_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.displayResolutionDialog = s_settings_recommendation.displayResolutionDialog;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EditorGUILayout.Separator();
|
|
|
|
|
|
|
|
|
|
|
|
using (new EditorGUILayout.HorizontalScope())
|
|
|
|
|
|
{
|
|
|
|
|
|
bool is_skip_at_startup = EditorGUILayout.ToggleLeft("Skip this window at startup", m_is_skip_at_startup);
|
|
|
|
|
|
if (is_skip_at_startup != m_is_skip_at_startup)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_is_skip_at_startup = is_skip_at_startup;
|
|
|
|
|
|
s_is_skip_at_start_up = m_is_skip_at_startup;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EditorGUI.BeginDisabledGroup(m_settings_changed == s_settings_recommendation);
|
|
|
|
|
|
if (GUILayout.Button("All Recommendation", GUILayout.Width(btn_recommendation_width + 16)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.Set(s_settings_recommendation);
|
|
|
|
|
|
}
|
|
|
|
|
|
EditorGUI.EndDisabledGroup();
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
|
|
|
EditorGUI.BeginDisabledGroup(m_settings_changed == m_settings_current);
|
|
|
|
|
|
if (GUILayout.Button("Apply", GUILayout.Width(btn_resotre_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.SaveToProject();
|
|
|
|
|
|
m_settings_current.Set(m_settings_changed);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (GUILayout.Button("Restore", GUILayout.Width(btn_resotre_width)))
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.Set(m_settings_current);
|
|
|
|
|
|
}
|
|
|
|
|
|
EditorGUI.EndDisabledGroup();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GUILayout.FlexibleSpace();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void OnDestroy()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_settings_changed != m_settings_current)
|
|
|
|
|
|
{
|
|
|
|
|
|
bool yes = EditorUtility.DisplayDialog("[WARNING] Project Settings Changed", "The ProjectSettingChecker will be closed, \nbut some values are modified.\nDo you want to apply those changed?", "Apply", "Give up");
|
|
|
|
|
|
if (yes)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_settings_changed.SaveToProject();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static string s_str_hash_code
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return UnityEngine.Animator.StringToHash(UnityEngine.Application.dataPath).ToString();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static bool s_is_skip_at_start_up
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return EditorPrefs.GetBool("ProjectSettingChecker_is_skip_at_start_up_" + s_str_hash_code);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
EditorPrefs.SetBool("ProjectSettingChecker_is_skip_at_start_up_" + s_str_hash_code, value);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|