unity3d “消息”不包含“消息”的定义[已关闭]

9wbgstp7  于 2022-12-19  发布在  其他
关注(0)|答案(1)|浏览(153)

已关闭。此问题需要details or clarity。当前不接受答案。
**想要改进此问题?**添加详细信息并通过editing this post阐明问题。

2天前关闭。
Improve this question
“Message”不包含“message”的定义,并且找不到接受“Message”类型的第一个参数的可访问扩展方法“message "

void DisplayMessage()
{
    Message messageToDisplay = currentMessages[activeMessage];
    messageText.text = messageToDisplay.message;

    Actor actorToDisplay = currentActors[messageToDisplay.actorId];
    actorName.text = actorToDisplay.name;
    actorImage.sprite = actorToDisplay.sprite;
}

我什么都试过了都没解决。我不明白

oug3syen

oug3syen1#

public Image actorImage;
public Text actorName;
public Text messageText;
public RectTransform backgroundBox;

Message[] currentMessages;
Actor[] currentActors;
int activeMessage = 0;

public void OpenDialogue(Message[] messages, Actor[] actors)
{
    currentMessages = messages;
    currentActors = actors;
    activeMessage = 0;


    Debug.Log("Started conversation! Loaded messages: " + messages.Length);
        
}

void DisplayMessage()
{
    Message messageToDisplay = currentMessages[activeMessage];
    messageText.text = messageToDisplay.message;

    Actor actorToDisplay = currentActors[messageToDisplay.actorId];
    actorName.text = actorToDisplay.name;
    actorImage.sprite = actorToDisplay.sprite;
}

// Start is called before the first frame update
void Start()
{
    
}

相关问题