unity3D技术之PlayerSettings.defaultScreenHeight 默认屏幕高度

更新时间:2023-09-29 11:52:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

static var defaultScreenHeight : int

Description描述

Default vertical dimension of stand-alone player window. 独立版窗口的默认垂直方向。 Custom player settings. 自定义播放器设置。

// Simple Script that saves and loads custom // Stand-alone/Web player screen settings among // Unity Projects

//保存和加载Unity项目的自定义狗刨学习网独立版/Web播放器设置 class CustomSettings extends EditorWindow {

function OnGUI() {

compName = EditorGUILayout.TextField(\

@MenuItem(\static function Init() { }

var window = GetWindow(CustomSettings); window.Show();

var compName : String = \var prodName : String = \var screenWidth : int = 640; var screenHeight : int = 480; var webScreenWidth : int = 640; var webScreenHeight : int = 480; var fullScreen : boolean = false;

compName);

prodName = EditorGUILayout.TextField(\

prodName);

EditorGUILayout.BeginHorizontal();

screenWidth = EditorGUILayout.IntField(\

screenWidth);

screenHeight = EditorGUILayout.IntField(\

screenHeight);

EditorGUILayout.EndHorizontal(); EditorGUILayout.Space();

EditorGUILayout.BeginHorizontal();

webScreenWidth = EditorGUILayout.IntField(\Width:\

webScreenWidth);

webScreenHeight = EditorGUILayout.IntField(\

Height:\

EditorGUILayout.EndHorizontal();

fullScreen = EditorGUILayout.Toggle(\

Screen:\

function SaveSettings() {

PlayerSettings.companyName = compName; PlayerSettings.productName = prodName;

PlayerSettings.defaultScreenWidth = screenWidth; PlayerSettings.defaultScreenHeight = screenHeight; PlayerSettings.defaultWebScreenWidth = webScreenWidth;

}

EditorGUILayout.BeginHorizontal(); if(GUILayout.Button(\

SaveSettings();

if(GUILayout.Button(\

LoadSettings();

EditorGUILayout.EndHorizontal();

PlayerSettings.defaultWebScreenHeight =

webScreenHeight;

EditorPrefs.SetString(\EditorPrefs.SetString(\EditorPrefs.SetInt(\EditorPrefs.SetInt(\EditorPrefs.SetInt(\EditorPrefs.SetInt(\

PlayerSettings.defaultIsFullScreen = fullScreen;

webScreenHeight);

}

function LoadSettings() {

compName = EditorPrefs.GetString(\prodName = EditorPrefs.GetString(\screenWidth = EditorPrefs.GetInt(\screenHeight = EditorPrefs.GetInt(\webScreenWidth =

EditorPrefs.GetInt(\

webScreenHeight =

EditorPrefs.GetInt(\ }

}

本文来源:https://www.bwwdw.com/article/f0hd.html

Top