Page 1 of 1

OnUse not working

Posted: Wed Feb 24, 2016 2:49 pm
by Ingot
I cannot get the OnUse method to work for initiating conversations.
Note that the OnTriggerEnter method does work just fine.
The following are the things that I have done to set up the scene:

On NPC
1. Created an empty game object and put it on a layer titled NPC.
2. Added a Sphere collider component with a radius of 30 and set it to trigger.
3. Added a Conversation trigger, set it to OnUse, assigned the correct database and chose the correct conversation.

On Player:
1. Created an fps controller that uses mouse look and a center of screen locked cursor (can be toggled unlocked with keypress).
2. Added a Selector component, added the NPC layer to the mask, set select at center of screen, chose distance from camera, set max dist to 2000, run raycasts in 3d, and set up the use key to be Z.

I tried changing the distance from setting, and the select at, but it still will not activate the convo.
I am including a couple screen shots of the player controller and the NPC.

https://gyazo.com/bde52fac1c57e9e6fe61a90182e59e33

https://gyazo.com/56d54be4cce85588736fb8899f8f9ff4

Can you please tell me what I am missing or doing wrong?

Re: OnUse not working

Posted: Wed Feb 24, 2016 7:47 pm
by Tony Li
Hi,

Add a Usable component to your Merchant. The Selector only sends OnUse to GameObjects that have Usable components.

Re: OnUse not working

Posted: Thu Feb 25, 2016 10:16 pm
by Ingot
Thank you, it works great now.