Version: 5.4
public static void SetFloat (string key, float value);

説明

key で識別される設定情報の値を設定します。

// Simple scripts that creates an empty window and remembers the position and size
// of the created window.

class RememberPosition extends EditorWindow { var width : float = 300; var height : float = 300; var x : float = 100; var y : float = 100;

@MenuItem("Examples/Remember position") static function Init() { var window = GetWindow(RememberPosition); window.Show(); } function Awake() { width = EditorPrefs.GetFloat("EditorWindowWidth", 300); height = EditorPrefs.GetFloat("EditorWindowHeight", 300); x = EditorPrefs.GetFloat("EditorWindowX", 100); y = EditorPrefs.GetFloat("EditorWindowY", 100);

position = Rect(x, y, width, height); } function OnDestroy() { EditorPrefs.SetFloat("EditorWindowWidth", width); EditorPrefs.SetFloat("EditorWindowHeight", height); EditorPrefs.SetFloat("EditorWindowX", x); EditorPrefs.SetFloat("EditorWindowY", y); } function OnGUI() { if(GUILayout.Button("Close")) this.Close(); } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961