Version: 2022.2
public RectOffset overflow ;

描述

要添加到背景图像的额外空间。

如果您的图像具有投影并且您希望将背景图像扩展到为使用该样式的 GUI 元素指定的矩形之外,则可以使用该方法。

using UnityEngine;

public class Example : MonoBehaviour { // Prints the left, right, top and down values of the GUIStyle overflow

RectOffset rctOff;

void OnGUI() { rctOff = GUI.skin.button.overflow; Debug.Log("Left: " + rctOff.left + " Right: " + rctOff.right); Debug.Log("Top: " + rctOff.top + " Bottom: " + rctOff.bottom); } }