Hello,
How do I assign methods from another gameobject to the proximity selector's OnSelectedUsable method?
I got this so far:
proximitySelector.onSelectedUsable.AddListener(
But then I'm completely lost. Is this even the right path to go down, or am I totally missing the right way to do this?
Thank you!
EDIT: Okay, as usual—the SECOND I post a question to a forum—I figure out a solution. For those wondering, here's what worked for me:
proximitySelector.onSelectedUsable.AddListener(delegate { someScript.someMethod(); });
I'd be curious to see if there's a better way to do this, or if there is some issue with the solution I found! Thanks again!
How to assign methods to OnSelectedUsable through script on Proximity Selector?
-
- Posts: 10
- Joined: Sun Mar 03, 2019 2:07 pm
Re: How to assign methods to OnSelectedUsable through script on Proximity Selector?
Nope, AddListener() is the way to do it. If you want to access the Usable that got selected, you can do it similarly like this:
Code: Select all
proximitySelector.onSelectedUsable.AddListener((usable) => { SomeMethod(usable); });
-
- Posts: 10
- Joined: Sun Mar 03, 2019 2:07 pm
Re: How to assign methods to OnSelectedUsable through script on Proximity Selector?
Thank you! I appreciate the follow up!