Forum rules - please read before posting.

Showing a hotspot label which has multiple lines and a image

I'd like to show a hotspot label which has multiple lines and a image.
Is it possible?
What I want to do is like this.(In this case, the label has multiple lines('talk' and 'Risaad') and a image('E').

Comments

  • The Hotspot menu can be modified to have additional elements. A Graphic element can be used to display the "E" as a texture.

    For the two lines, it's best to separate the text into two separate Label elements, and have both get their text from Global String Variables instead of the default Hotspot text.

    To do this, replace the Hotspot menu's existing HotspotLabel element with two new Label elements, and set both of their "Label type" properties to "Global Variable".

    Then create two Global String variables in the Variables Manager named HotspotVerb and HotspotName, and have your two Label elements reference them.

    You can then have a custom script hook into the OnHotspotSelect custom event to update these variable values when a Hotspot is selected - and in turn, update the display of the Hotspot menu:

    using UnityEngine;
    using AC;
    
    public class CustomHotspotLabels : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnHotspotSelect += OnHotspotSelect; }
        private void OnDisable () { EventManager.OnHotspotSelect -= OnHotspotSelect; }
    
        private void OnHotspotSelect (Hotspot hotspot)
        {
            int language = Options.GetLanguage ();
            int iconID = hotspot.GetFirstUseIcon ();
            CursorIcon icon = KickStarter.cursorManager.GetCursorIconFromID (iconID);
    
            string verbText = (icon != null) ? icon.GetLabel (language) : string.Empty;
            GlobalVariables.GetVariable ("HotspotVerb").TextValue = verbText;
    
            string hotspotName = hotspot.GetName (language);
            GlobalVariables.GetVariable ("HotspotName").TextValue = hotspotName;
        }
    
    }
    
  • Thank you for you help! Perfect!

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.