版本:Unity 6 (6000.0)
语言英语
  • C#

AndroidApplication.currentConfiguration

建议更改

成功!

感谢你帮助我们提高 Unity 文档的质量。虽然我们无法接受所有提交内容,但确实会阅读来自用户提出的每条建议更改内容,并在可行的情况下进行更新。

关闭

提交失败

由于某些原因,你建议的更改未能提交。请在几分钟后<a>重试</a>。感谢你花时间帮助我们提高 Unity 文档的质量。

关闭

取消

public static Android.AndroidConfiguration currentConfiguration;

描述

提供当前运行的应用程序的配置。

using UnityEngine;
using UnityEngine.Android;

public class ShowConfiguration : MonoBehaviour {

public void Start() { var contents = new System.Text.StringBuilder(); var c = AndroidApplication.currentConfiguration; contents.AppendLine($"* ColorMode, Hdr: {c.colorModeHdr}"); contents.AppendLine($"* ColorMode, Gamut: {c.colorModeWideColorGamut}"); contents.AppendLine($"* DensityDpi: {c.densityDpi}"); contents.AppendLine($"* FontScale: {c.fontScale}"); contents.AppendLine($"* FontWeightAdj: {c.fontWeightAdjustment}"); contents.AppendLine($"* Keyboard: {c.keyboard}"); contents.AppendLine($"* Keyboard Hidden, Hard: {c.hardKeyboardHidden}"); contents.AppendLine($"* Keyboard Hidden, Normal: {c.keyboardHidden}"); contents.AppendLine($"* Mcc: {c.mobileCountryCode}"); contents.AppendLine($"* Mnc: {c.mobileNetworkCode}"); contents.AppendLine($"* Navigation: {c.navigation}"); contents.AppendLine($"* NavigationHidden: {c.navigationHidden}"); contents.AppendLine($"* Orientation: {c.orientation}"); contents.AppendLine($"* ScreenHeightDp: {c.screenHeightDp}"); contents.AppendLine($"* ScreenWidthDp: {c.screenWidthDp}"); contents.AppendLine($"* SmallestScreenWidthDp: {c.smallestScreenWidthDp}"); contents.AppendLine($"* ScreenLayout, Direction: {c.screenLayoutDirection}"); contents.AppendLine($"* ScreenLayout, Size: {c.screenLayoutSize}"); contents.AppendLine($"* ScreenLayout, Long: {c.screenLayoutLong}"); contents.AppendLine($"* ScreenLayout, Round: {c.screenLayoutRound}"); contents.AppendLine($"* TouchScreen: {c.touchScreen}"); contents.AppendLine($"* UiMode, Night: {c.uiModeNight}"); contents.AppendLine($"* UiMode, Type: {c.uiModeType}");

contents.AppendLine($"* Locales ({c.locales.Length}):"); for (int i = 0; i < c.locales.Length; i++) { var l = c.locales[i]; contents.AppendLine($"* Locale[{i}] {l.country}-{l.language}"); };

Debug.Log($"Current Config:\n{contents}"); } }