public static void TryAdd(ProjectPrefsSO projectPrefsSO) { if (InBuild == null && projectPrefsSO.name.ToLower().Contains(nameof(InBuild).ToLower())) { InBuild = projectPrefsSO; } #if UNITY_EDITOR else if (InEditor == null && projectPrefsSO.name.ToLower().Contains(nameof(InEditor).ToLower())) { inEditor = projectPrefsSO; } #endif }
private static ProjectPrefsSO FindInEditorSO() { foreach (string guid in AssetDatabase.FindAssets("t:scriptableobject")) { ScriptableObject so = AssetDatabase.LoadAssetAtPath <ScriptableObject>(AssetDatabase.GUIDToAssetPath(guid)); if (so.GetType() == typeof(ProjectPrefsSO) && so.name.ToLower().Contains(nameof(InEditor).ToLower())) { inEditor = so as ProjectPrefsSO; return(inEditor); } } return(null); }