Hi Tony, thank you so much for this great asset. I am seeing if there is a way to call a method in a c# script I wrote through the Usable component's OnUse()?
For example, if my NPC has a "LookAtPlayer" function that rotates him to the player, how can I call this either through the component, or in code when the Useable component is used?
thanks!
Call a Custom Method with Usable's OnUse()
Re: Call a Custom Method with Usable's OnUse()
Hi,
You can do either. You can add an OnUse(Transform) method to a script on the NPC:
Or hook up a method to the OnUse() UnityEvent.
Or, if this is a conversation, use the LookAt() sequencer command or something similar in the conversation.
You can do either. You can add an OnUse(Transform) method to a script on the NPC:
Code: Select all
void OnUse(Transform player)
{
transform.LookAt(player);
}
Or, if this is a conversation, use the LookAt() sequencer command or something similar in the conversation.