您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
35 行
1.1 KiB
35 行
1.1 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering;
|
|
|
|
public static class SetupProject
|
|
{
|
|
public static void ApplySettings()
|
|
{
|
|
var options = new Dictionary<string, Action>
|
|
{
|
|
{ "gamma", () => PlayerSettings.colorSpace = ColorSpace.Gamma },
|
|
{ "linear", () => PlayerSettings.colorSpace = ColorSpace.Linear },
|
|
{ "glcore", () => SetGraphicsAPI(GraphicsDeviceType.OpenGLCore) },
|
|
{ "d3d11", () => SetGraphicsAPI(GraphicsDeviceType.Direct3D11) },
|
|
{ "d3d12", () => SetGraphicsAPI(GraphicsDeviceType.Direct3D12) },
|
|
{ "vulkan", () => SetGraphicsAPI(GraphicsDeviceType.Vulkan) }
|
|
};
|
|
|
|
var args = Environment.GetCommandLineArgs();
|
|
foreach (var arg in args)
|
|
{
|
|
Action action;
|
|
if (options.TryGetValue(arg, out action))
|
|
action();
|
|
}
|
|
}
|
|
|
|
static void SetGraphicsAPI(GraphicsDeviceType api)
|
|
{
|
|
var currentTarget = EditorUserBuildSettings.activeBuildTarget;
|
|
PlayerSettings.SetGraphicsAPIs(currentTarget, new [] { api } );
|
|
}
|
|
}
|