Page 3 of 3

Re: OnTriggerEnter combined with Button Press

Posted: Fri Jan 06, 2017 1:28 am
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

Re: OnTriggerEnter combined with Button Press

Posted: Fri Jan 06, 2017 9:38 am
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.

Re: OnTriggerEnter combined with Button Press

Posted: Thu Mar 23, 2017 6:59 am
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.

Re: OnTriggerEnter combined with Button Press

Posted: Thu Mar 23, 2017 9:15 am
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.