Maybe a weird question. I'm just getting into this system and I was noticing the Usable class. I figured I might consolidate my own interaction system and just use this.
The downside to this idea is that it looks like the use functions cannot pass data through them? Is there a clean way to tell and object who interacted with them?
If the game only had players interacting that wouldn't be too big of a deal, but the critters in my game interact with items and one another.
Just trying my best to not have two different interaction systems in the game. So if this exist in some fashion that'll be handy. Perhaps I'm looking at the problem wrong, not sure.
Sending the user through Usable.
Re: Sending the user through Usable.
Hi,
The Usable component is primarily just used for targeting. It tells the Selector or Proximity Selector that the GameObject is targetable, although it does have those utility UnityEvents which are often used to activate and deactivate some kind of visual indicator on the Usable GameObject.
When a Selector or Proximity Selector uses a Usable, it also invokes OnUse(Transform user) to all scripts on the Usable GameObject, and optionally to all of the Usable GameObject's children if Broadcast To Children is ticked.
So you only need to add a method of your own that has an OnUse(Transform user) method.
The Usable component is primarily just used for targeting. It tells the Selector or Proximity Selector that the GameObject is targetable, although it does have those utility UnityEvents which are often used to activate and deactivate some kind of visual indicator on the Usable GameObject.
When a Selector or Proximity Selector uses a Usable, it also invokes OnUse(Transform user) to all scripts on the Usable GameObject, and optionally to all of the Usable GameObject's children if Broadcast To Children is ticked.
So you only need to add a method of your own that has an OnUse(Transform user) method.
Re: Sending the user through Usable.
Ah sweet, secondary broadcast should do precisely what I need. Thanks!Tony Li wrote: ↑Wed Sep 18, 2024 7:54 am Hi,
The Usable component is primarily just used for targeting. It tells the Selector or Proximity Selector that the GameObject is targetable, although it does have those utility UnityEvents which are often used to activate and deactivate some kind of visual indicator on the Usable GameObject.
When a Selector or Proximity Selector uses a Usable, it also invokes OnUse(Transform user) to all scripts on the Usable GameObject, and optionally to all of the Usable GameObject's children if Broadcast To Children is ticked.
So you only need to add a method of your own that has an OnUse(Transform user) method.
Re: Sending the user through Usable.
Glad to help!