Selector > OnSelectedUsable

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
talesworth
Posts: 2
Joined: Thu Aug 01, 2024 1:52 pm

Selector > OnSelectedUsable

Post by talesworth »

I have a FPS controller with a Selector component. I have a door with a Usable component. I'm having trouble with the Selector's OnSelectedUsable UnityEvent. When I set that event, I'm getting this error:
Image
But, it looks like the usable being passed in (the wooden door with the Usable component on it) is the correct type.

If I set the OnSelect() event on the Usable itself to a custom method, that works, but I'd rather set the selector's "on select" method so that I can call the same method for every Usable.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Selector > OnSelectedUsable

Post by Tony Li »

Hi,

Double check the configuration of your Selector component's OnSelectedUsable() UnityEvent in the inspector. It may be misconfigured.
talesworth
Posts: 2
Joined: Thu Aug 01, 2024 1:52 pm

Re: Selector > OnSelectedUsable

Post by talesworth »

In the inspector, it is setup like this:
Image

And here is the function:
Image

The error thrown is:
ArgumentException: Object of type 'UnityEngine.Object' cannot be converted to type 'PixelCrushers.DialogueSystem.Usable'.

I was under the impression that when the selector selects (aka hovers) a Usable, the Unity Event calls that function and it would pass in the Usable so that I can act on it (in my case, highlight the game object).
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Selector > OnSelectedUsable

Post by Tony Li »

In the dropdown menu where you selected FPSController.OnHoverUsable, check if there's a "Dynamic" menu option for that method.
Post Reply