Пример #1
0
        public static SettingsProvider CreateHybridRendererSettingsProvider()
        {
            var provider = new SettingsProvider("Project/Hybrid Renderer Settings", SettingsScope.Project)
            {
                label      = "Hybrid Renderer",
                guiHandler = (searchContext) =>
                {
                    var settings = HybridRendererSettings.GetSerializedSettings();
                    EditorGUILayout.PropertyField(settings.FindProperty("PersistentGPUMemoryMB"), new GUIContent("Persistent GPU Buffer Size (MB)"));
                    settings.ApplyModifiedProperties();
                },

                keywords = new HashSet <string>(new[] { "Persistent GPU Buffer Size" })
            };

            return(provider);
        }
Пример #2
0
        public static HybridRendererSettings GetOrCreateSettings()
        {
#if UNITY_EDITOR
            var settings = AssetDatabase.LoadAssetAtPath <HybridRendererSettings>(kHybridRendererSettingsPath);
            if (settings == null)
            {
                settings = CreateDefaultSettings();
                AssetDatabase.CreateAsset(settings, kHybridRendererSettingsPath);
                AssetDatabase.SaveAssets();

                var preloadedAssets = PlayerSettings.GetPreloadedAssets().ToList();
                preloadedAssets.Add(settings);
                PlayerSettings.SetPreloadedAssets(preloadedAssets.ToArray());
            }
            return(settings);
#else
            if (settingsInstance == null)
            {
                settingsInstance = CreateDefaultSettings();
            }
            return(settingsInstance);
#endif
        }
Пример #3
0
 void OnEnable()
 {
     settingsInstance = this;
 }