Page 1 of 1

Selector > OnSelectedUsable

Posted: Thu Aug 01, 2024 2:00 pm
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.

Re: Selector > OnSelectedUsable

Posted: Thu Aug 01, 2024 11:30 pm
by Tony Li
Hi,

Double check the configuration of your Selector component's OnSelectedUsable() UnityEvent in the inspector. It may be misconfigured.

Re: Selector > OnSelectedUsable

Posted: Fri Aug 02, 2024 2:21 pm
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).

Re: Selector > OnSelectedUsable

Posted: Sat Aug 03, 2024 12:01 am
by Tony Li
In the dropdown menu where you selected FPSController.OnHoverUsable, check if there's a "Dynamic" menu option for that method.