Game Development Reference
In-Depth Information
The Conversation Component
The last thing we need is a simple component to be able to attach conversations to a char-
acter or other game object in keeping with the Unity-component-based way of building
games.
So, create a new class in the Classes folder under Assets\Scripts named Con-
versationComponent and replace its contents with the following code:
using UnityEngine;
public class ConversationComponent : MonoBehaviour {
public Conversation[] Conversations;
}
Nothing's complicated for now; the preceding code just holds an array of the possible con-
versations that the game object can have. Ideally, you would want to expand on this for a
fuller conversation system, such as a pointer to the next conversation, or a way to track
how many conversations have taken place, and so on.
Search WWH ::




Custom Search