为了从 Unity 的启动画面创建动态淡入效果,我试图在运行时获取启动画面背景的颜色。
在编辑器中,可以在Edit > Project Settings > Player > Splash Image > Background找到颜色。
在研究如何获得这种颜色时,我偶然发现了
PlayerSettings.SplashScreen.backgroundColor
. 但是,PlayerSettings
该类包含在UnityEditor
命名空间中,在运行时无法访问。
我如何在运行时动态获取初始屏幕背景的颜色?
编辑:使用 IL 反编译器,我发现 UnityEditor 程序集通过外部方法解决了这个问题。但是,我仍然看不到从编辑器程序集中获取背景颜色的方法。
public static Color backgroundColor
{
get
{
Color result;
PlayerSettings.SplashScreen.INTERNAL_get_backgroundColor(out result);
return result;
}
// ...
}
private static extern void INTERNAL_get_backgroundColor(out Color value);