![]() In the code above we create a new instance of OscovaBot. Var newMessage = new Message ", MessageType.Bot) public void AddMessage(string messageText, MessageType messageType)ĭestroy() Next we'll add a AddMessage() method to the script that will add Text object instances to the Content element of the Viewport with the user or bot's text message and will also control the number of Text objects in memory. :video videos/unity-attach-game-manager.mp4 Add Message to Panel OscovaBot MainBot Īs in Unity the public fields can be assigned visually, we will now go back to our unity project by closing the Visual Studio project and focusing on Unity. In the GameManager class add the following fields before the void Start() method. We'll now add a couple of fields to the code to connect Content of viewport, Text prefab, Input Field and the send Button. In the code below we create a Message class that will hold information like the user or bot message, message type and the associated Text UI object. Start is called before the first frame updateĪbove the GameManager class code add the following code. The current code should look something like the following. This should open a Visual Studio project.
0 Comments
Leave a Reply. |