OnTriggerEnter combined with Button Press

Announcements, support questions, and discussion for the Dialogue System.
OneManOnMars
Posts: 106
Joined: Tue Apr 05, 2016 9:37 am

Re: OnTriggerEnter combined with Button Press

Post by OneManOnMars »

Happy new Year!

Thank you for your advice. It worked nicely.
Just one thing I could't figure out. The image now stays on the canvas where it is placed.

Is there a way to let the image stick with the npc. As it was with the text from the proximity selector I used before?

Many thanks
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter combined with Button Press

Post by Tony Li »

Happy New Year!

Add a Usable Unity UI component to the NPC.

Look at Examples > Unity UI Examples > SF Example Scene for an example. The NPC named "Sergeant Graves" has a Usable Unity UI:

Image

By using this component, you can place the NPC's world space canvas exactly where you want, and you can make each one unique. For example, the image for an NPC might be a chat bubble, while the image for a door might be a hand.
OneManOnMars
Posts: 106
Joined: Tue Apr 05, 2016 9:37 am

Re: OnTriggerEnter combined with Button Press

Post by OneManOnMars »

Thank you. I ended up adding a button with a standard script, was easier then figuring out out to use the proper solution.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: OnTriggerEnter combined with Button Press

Post by Tony Li »

Fair enough. Those scripts are in a folder named "Supplemental" because they're not core scripts. It's not a case of proper vs. not-proper. They're just included as bonus content in case people find them helpful. But for a lot of cases it's just easier to write a simple script.
Post Reply