Page 1 of 1

Receive error when OnConversationStart(Transform) is called.

Posted: Wed Mar 15, 2023 2:57 pm
by jgifford
The below error is generated when the OnConversationStart(Transform) event is invoked in the DialogueSystemEvents component. This prevents the event from actually running the method I need it to.

Unity Version: 2022.2.10
OS: Windows 10

Code: Select all

ArgumentException: Object of type 'UnityEngine.Object' cannot be converted to type 'UnityEngine.Transform'.

Re: Receive error when OnConversationStart(Transform) is called.

Posted: Wed Mar 15, 2023 4:06 pm
by Tony Li
Hi,

Make sure you're using the current version of the Dialogue System.

Then check what's actually assigned to the OnConversationStart() UnityEvent. Something may be assigned incorrectly. If this doesn't help, please post a screenshot of the OnConversationStart() UnityEvent of your Dialogue System Events inspector.

Re: Receive error when OnConversationStart(Transform) is called.

Posted: Thu Mar 16, 2023 8:04 pm
by jgifford
I am using version 2.2.34

The forum won't let me post the full stack trace unfortunately. It says "Forbidden. You sent forms too often. Please wait a few minutes. Contains contacts." But double clicking it in Unity opens ConversationModel.cs, line 214 in the InformParticipants method.

What I am trying to do is call a function in my PlayerController class that locks the camera's view on the actor when the conversation starts. This error is thrown even with a blank function though.

Code: Select all

        public void OnDialogueStart(Transform actor)
        {
            DialogueLookTarget lookTarget = actor.GetComponentInChildren<DialogueLookTarget>();
            look.SmoothLookAt(lookTarget == null ? actor.position : lookTarget.position, dialogueSmoothLookAtTime);

            SetState(State.Dialogue);
        }
Screenshot 2023-03-16 190112.png
Screenshot 2023-03-16 190112.png (34.69 KiB) Viewed 193 times

Re: Receive error when OnConversationStart(Transform) is called.

Posted: Thu Mar 16, 2023 9:12 pm
by Tony Li
Hi,

Try assigning a Transform to the first UnityEvent element (PlayerController.OnDialogueStart) or -- probably better yet -- select the Dynamic version of PlayerController.OnDialogueStart from the dropdown menu. This will make it pass the actual transform that was sent with the OnConversationStart message.

Re: Receive error when OnConversationStart(Transform) is called.

Posted: Thu Mar 16, 2023 9:54 pm
by jgifford
Well that is embarrassing... I had selected the static version of the method in the dropdown instead of the dynamic one.

Thank you for the help!

Re: Receive error when OnConversationStart(Transform) is called.

Posted: Thu Mar 16, 2023 10:12 pm
by Tony Li
No worries -- glad I could help!