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:
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.
Selector > OnSelectedUsable
Re: Selector > OnSelectedUsable
Hi,
Double check the configuration of your Selector component's OnSelectedUsable() UnityEvent in the inspector. It may be misconfigured.
Double check the configuration of your Selector component's OnSelectedUsable() UnityEvent in the inspector. It may be misconfigured.
-
- Posts: 2
- Joined: Thu Aug 01, 2024 1:52 pm
Re: Selector > OnSelectedUsable
In the inspector, it is setup like this:
And here is the function:
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).
And here is the function:
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
In the dropdown menu where you selected FPSController.OnHoverUsable, check if there's a "Dynamic" menu option for that method.