HyperText for Unity 4.6

If you’re already working in the open beta of Unity 4.6, you’re hopefully on your way to making a great UI with the new UI system. If you’re looking to get a little bit more out of the UI system though, I’m happy to report I have a new asset store package available today! The package, which I’ve called HyperText, adds some new functionality to the built-in Text component, including the ability to:

  • emit callbacks for different mouseover/touch states
  • create custom styles for links and your own rich text tags
  • easily reuse and manage styles throughout your project
  • display sprites inline with text as quads, and
  • automatically detect and tag keywords

Check out the 1.0 video for more info:

In related news, I’ve simultaneously released version 2.0 of my Property Backing Field Drawer package. It now features all kinds of new dark magic to make it even easier to use. Changes include:

  • Unity 4.5 is new minimum version.
  • Added IPropertyBackingFieldCompatible interface and PropertyBackingFieldCompatibleObject base class, which are used to support custom serializable structs and classes.
  • You can now use setter logic that only triggers on value changes! Note that custom serializable classes will always supply a clone.
  • Full support for undo/redo and reverting to prefab for all property types in any play mode state!
  • PropertyBackingFieldDrawer.DisplayArrayPropertyField() and PropertyBackingFieldDrawer.DisplayReorderableListPropertyField() were removed and are no longer necessary!
  • No naming assumptions are made for IList backing fields and their respective properties anymore!
  • Properties and their respective backing fields need not match type, as long as the backing field type is assignable from the property type.
  • Fixed bug that could cause some enum properties to not be set properly.
  • Fixed bug calculating property drawer height when property was followed by another whose name was prefixed with the preceding property’s name.
  • Changed some access modifiers and method signatures of utility methods which should generally not be needed anyway.

12 thoughts on “HyperText for Unity 4.6”

  1. Hey Adam,

    Looks really great! I was thinking we might use HyperText to replace an existing rich text system we built using NGUI, but I can’t tell if we’d be able to do word-by-word highlighting easily. My company has done several children’s books recently, and we usually have narration playing and the text highlighting words as they are spoken. If we wanted to do something similar in HyperText, would we have to manually adjust style tags in the text as words should be highlighted?

  2. That’s right Josh. You’d basically need to know something about how to segment your text, and then just inject the tags and pass the text to the HyperText. Here’s a quick naive example:

    using UnityEngine;

    public class WordByWord : MonoBehaviour, System.Collections.IEnumerator
        private Candlelight.UI.HyperText hyperText;
        private int index = 0;
        private System.Text.StringBuilder sb;
        public string styleTag;
        private string[] words;

        void Start()
            hyperText = GetComponent<Candlelight.UI.HyperText>();
            words = hyperText.text.Split(' ');

        public object Current
                return words[index];

        public bool MoveNext()
            index += 1;
            if (index < words.Length)
                return true;
            return false;

        public void Reset()
            index = 0;

        private void SetText()
            sb = new System.Text.StringBuilder();
            for (int i = 0; i < words.Length; ++i)
                if (i == index)
                        " <{0}>{1}</{0}>", styleTag, words[i]
                    sb.AppendFormat(" {0}", words[i]);
            hyperText.text = sb.ToString().Substring(1);

  3. Hi Adam, I have a question for you: is there a way to jump from keyword (“link”) to keyword using a gamepad (analog stick or dpad)? And if so, how would I go about implementing something like this through code (c#)? Thanks!

  4. Hi Seith,

    Right now controller support is not implemented, but it is actually the next feature on my roadmap. Keep an eye on my website or the UAS product page for updates.

  5. HoLA!
    I am most enjoying your Hypertext asset.
    I am having problems with the custom tags though.
    It seems that only the first of any tag is recognized in the text.
    so a word like H2N2 would only subscript the first 2. This happens with text typed into the editor or loaded dynamically. Is this a known issue? am I doing something wrong?

  6. Thanks for getting in touch, Quentin! I’m out of town right now and won’t be able to get to this right away. Can you please send an email to bugs@candlelightinteractive.com or post in the support forum here: groups.google.com/a/candlelightinteractive.com/forum/m/#!categories/developer-support/uas-hypertext

  7. Hi Adam,

    Wonderful tool–it’s helping me out immensely! I was wondering if there are ways to create tags at runtime through script. For instance, if I were to want to change the text of a normal Text component, I would do myText.text = “example”;. Is there a way to add a tag in a hypertext component in a similar manner? My project is text heavy, so I’m trying to keep the game object count down to a manageable level.

  8. I’ve tried digging around in the documentation but couldn’t find what I was looking for so I figured I’d ask here.

    Is it possible to give a custom tag hidden information in the form of a parameter?

    What I’m looking for is having a tag hold information for its highlighted text to supply when a callback is triggered on that text.

    IE. Hello!

    where the tooltip tag than has a mouseover callback which creates a popup using the display property.

    Looks like a great plugin thusfar, hope to hear back from you.

  9. urgh… The website ate my example! haha.

    IE: (tooltip display=”this is a greeting”) hello! (/tooltip)
    (there that was the example, this time made with characters that don’t cause the comment system to derp)

  10. Hi there! The recommended way to do what you’re trying to do is to use a link subclass, not a custom tag. In that case, you could do:

    <a class=”tooltip” name=”this is a greeting”>Hello!</a>

    That said, I’d probably use a KeywordsGlossary like in the included popup example. If you need more help I’m happy to talk more on the official support forum here: https://groups.google.com/a/candlelightinteractive.com/forum/#!categories/developer-support/uas-hypertext

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.