0
我无法解决这个问题,我希望有人知道如何做到这一点。Unity - C# - 将GameObject附加到公共按钮CommunicationButton;
我有什么
一个按钮和一个画布上的文本字段,看到的图像:
我有一个名为HumanInstructions脚本,初始化像这样:
public Text CommunicationMessage;
public Button CommunicationButton;
现在我可以在检查员中指定相应的GameObject,由cho在下拉菜单中选择按钮/文本框。
我想要什么,是通过脚本选择GameObject。该文本框称为CrazyMsg,该按钮称为CommunicationButton。所以我想要这样的东西:
public override void OnAwake()
{
CommunicationMessage = GameObject.find("CrazyMsg");
CommunicationButton = GameObject.find("CommunicationButton");
}
它不起作用。帮帮我!