OnUse not working

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Ingot
Posts: 8
Joined: Sun Feb 21, 2016 3:29 pm

OnUse not working

Post 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?
User avatar
Tony Li
Posts: 22106
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnUse not working

Post by Tony Li »

Hi,

Add a Usable component to your Merchant. The Selector only sends OnUse to GameObjects that have Usable components.
Ingot
Posts: 8
Joined: Sun Feb 21, 2016 3:29 pm

Re: OnUse not working

Post by Ingot »

Thank you, it works great now.
Post Reply