有没有办法将EditorGUILayout.PropertyField的输入显示到文本框中?
这是我想出的:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class clue : MonoBehaviour
{
public Text hintText;
void Start()
{
HintText.Text = EditorGUILayout.PropertyField(levelInfo.FindPropertyRelative("clue"));
}
}
我试过了。感谢任何可以提供帮助的人。
难道你不能只在类中添加公共字符串字段吗?
它将显示在Inspector中,您可以在其中输入,然后将此字符串值分配给hintText.text
。
如果您使用自定义Inspector抽屉来制作一些自定义的复杂结构,请考虑创建一个具有所需结构的单独的非MonoBehaviour类,并使用System.Serializable
属性使该类的对象在Inspector中可见。像这样: