public void ShowConversationDialog(FDCreature creature, ConversationId conversation) { // Canvas if (currentDialog != null) { Destroy(currentDialog); currentDialog = null; } // Move the map to corresponding location // Show dialog int animationId = creature?.Definition?.AnimationId ?? 0; string message = LocalizedStrings.GetConversationString(conversation); //Debug.Log("Showing message dialog: " + message); Vector3 popupPosition = Vector3.zero; if (creature != null) { UICreature uiCreature = GetUICreature(creature.CreatureId); Vector3 viewPoint = mainCamera.WorldToViewportPoint(uiCreature.transform.position); RectTransform canvasRect = GameCanvas.GetComponent <RectTransform>(); popupPosition = new Vector3( viewPoint.x * canvasRect.sizeDelta.x - canvasRect.sizeDelta.x * 0.5f, viewPoint.y * canvasRect.sizeDelta.y - canvasRect.sizeDelta.y * 0.5f, 0); } MessageDialog messageDialog = GameObjectExtension.CreateFromPrefab <MessageDialog>("Prefabs/MessageDialog"); messageDialog.Initialize(uiCamera, popupPosition, animationId, message, (index) => { this.OnDialogCallback(index); }, this.ChapterId); currentDialog = messageDialog.gameObject; }