Forum rules - please read before posting.

Anchoring an AC menu over an NPC (not a subtitle).

Hi! Sorry to bother you guys yet again. I was just wondering how would you anchor an AC menu (or UGUI), which is not for subtitles, over an  NPCs head? like a small button and/or label which would just show up when you get near the NPC with an image of a button or a text with the word "Talk", to let the player know they can talk to the NPC if they press said button?

I thought I should ask here first because, Ive seen AC has the option to position menus above the player or over the speaker, usually for subtitles, but I want this to happen regardless if the player doesn't speak to the NPC or if he doesn't have a hotspot or trigger, just like a bark, which can follow the NPC around if needed. So, I imagined there's some code already in AC which I can be used to do it. I already got covered the way to get things to run/happen on proximity but I'm unsure how I would reposition the AC menu to be above the NPC.

I've also thought of using a world space canvas as a prefab and put it in all NPCs, but that just feels a little less elegant, I would prefer it if the process was more dynamic (not to mention I may still have to connect the menus to AC somehow...).

Anyways, as usual, any advice would be greatly appreciated.

Comments

  • A Menu's Position setting should generally be independent of it's Appear type setting - a Menu can still be above a character even if it's not When Speech Plays.  What you probably want is an Appear type of On Hotspot, that contains an Interaction element.

    This can be an icon or a label (e.g. "Talk") that should correspond with whatever interactions are available on the NPC's Hotspot.  The 2D Demo uses something similar when Hotspots are clicked on.

    Failing that, you could also use a custom event to display your own Unity UI whenever you mouse-over a Hotspot.  The OnHotspotSelect event is what you want - have a look at this tutorial on how to trigger it.
  • Alright, I'll give it a try. But I probably need a refresher. I've got to be honest and admit I've mostly been using automatic barks (managed by triggers), and I'm also planning to use The Dialogue System plugin because I'll be doing some heavy branching and conditioning of conversations (plus the quest system). Somehow, I seem to remember that in the 3D Tutorial you made a hotspot over brain to have it trigger the conversation. But do NPCs always carry a hotspot? I somehow had the impression you couldn't have moving hotspots? Guess I need to give the manual and the videos a quick check again. 
    After that I'll give your advice a try. Thanks.
  • Duh, now I know why I had the impression that NPCs didn't have hotspots. While tinkering with FinalIK's grounder I changed the NPCs layer to avoid the player trying to climb the NPCs, lol. Problem is, obviously, AC stopped seeing them and I stopped getting label and hotspot funcionality from them. 

    Well, now whichever path or type of UI I choose, it should be a lot easier to implement a floating menu. Sorry for the bother!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.