直接上代码,我试用了个scb.value; scroolbar 控制亮度的
有任何问题可以添加 QQ群 207019099
///
/// 控制手机亮度
///
///
public void SetApplicationBrightnessTo(float Brightness)
{
Brightness = scb.value;
AndroidJavaObject Activity = null;
Activity = new AndroidJavaClass(“com.unity3d.player.UnityPlayer”).GetStatic(“currentActivity”);
Activity.Call(“runOnUiThread”, new AndroidJavaRunnable(() => {
AndroidJavaObject Window = null, Attributes = null;
Window = Activity.Call(“getWindow”);
Attributes = Window.Call(“getAttributes”);
Attributes.Set(“screenBrightness”, Brightness);
Window.Call(“setAttributes”, Attributes);
}));
}