在此项目中,您能够访问使用 Visual Effect Graph 制作的示例场景和效果。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

58 行
1.4 KiB

using System;
using System.Collections.Generic;
using UnityEngine;
namespace GameOptionsUtility
{
public class GameOptions : MonoBehaviour
{
public class Preferences
{
public const string prefix = "GameOptions.";
}
[RuntimeInitializeOnLoadMethod]
static void Initialize()
{
var gameObject = new GameObject("Game Options");
gameObject.AddComponent<GameOptions>();
DontDestroyOnLoad(gameObject);
Load();
}
private void Start()
{
Apply();
}
static void Load()
{
foreach(var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
try
{
foreach(var type in assembly.GetTypes())
{
if(type.IsSubclassOf(typeof(GameOption)) && !type.IsAbstract)
{
GameOption.Add(type);
}
}
}
catch
{
Debug.LogWarning($"Could not load any game option from assembly {assembly.FullName}");
}
}
}
public static void Apply()
{
foreach(var gameOption in GameOption.all)
{
gameOption.Apply();
}
}
}
}