Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Text Box

Discussion in 'Assets and Asset Store' started by Jasper-Flick, Feb 24, 2012.

  1. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Really cool stuff coming. Nice One.
     
  2. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    @rocki The cool stuff have arrived!

    Text Box 2 beta 2.0 is now in the store. Here are the changes.

    Minimum Unity version is now 4.5.2.
    New: Included Clipping library, which introduces clipping functionality.
    New: Icluded EventSystem library, which handles user input. It supports a subset of what Unity 4.6 uGUI might have.
    New: TextBox now has a textScale variable, which allows text scaling without changing text styles.
    New: TextBox now has a Rendered event.
    New: TextRenderer now has a textBox variable, so subclasses can easily access their parent box in case they need to query it.
    New: TextMeshRenderer now has a uv2Mode, which can be used to generate secondary uv coordinates.
    New: Added ClippedTextBox component, which adds clipping support to TextBox.
    New: TextRenderer now support clipping.
    New: Text Box Smooth shaders can now support clipping.
    New: Text Box Smooth shaders can now support a mask texture, using secondary uv.
    New: Added reasonable default configuration for some components.
    New: Added Text Box and Clipping menu items under Assets and GameObject editor menus.
    Fix: TextBox.textRenderers array is no longer public.
    Fix: Worked around a Unity bug that causes a console warning message when a text style collection asset is selected.
    Obsoleted: AutomaticParentSelector has been superceded by the SelectionBase attribute. The components should remove themselves.

    Check the code documentation to find out how the new Clipping and EventSystem stuff works. I will make separate written documentation available later as well.

    The next big thing on the roadmap is getting feedback on where and what in the text you clicked or touched. And don't hesitate to ask for specific features, because that's how they get on the roadmap!
     
    Last edited: Jul 23, 2014
  3. EmeralLotus

    EmeralLotus

    Joined:
    Aug 10, 2012
    Posts:
    1,459
    Awesome. Downloaded the new goodies.
    Cheers.
     
  4. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
  5. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    Version 2, beta 2.1 is now out!

    New: Added Bounds property to TextRenderer and TextMeshRenderer, to get their 3D bounds.
    New: Added TextRendererBounds property to TextBox, to get the combined 3D bounds of its renderers.
    New: Added supersample option to Text Box Smooth Auto shader.

    Needing the actual bounds of the text box content turned out to be a common use case, so I added properties for that.

    I also added a supersample option to the Smooth Auto shader. While it needs to make more texture samples, it produces superior results for small text. Here is a double-size comparison between, from left to right,
    1. no mipmapping and no supersampling;
    2. mipmapping with anisotropic filtering and no supersampling;
    3. supersampling and no mipmapping.
    no-ss-no-mips.png no-ss-mips.png ss-no-mips.png

    Supersampling needs access to the full-resolution texture to work properly, so you should turn off mipmapping when using it.
     
    Last edited: Aug 5, 2014
  6. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    Text Box 2 beta 3 has been released.

    Besides some fixes and changes, you're now able to query TextBox for character, string, and meta tag data relative to a point in world space. This allows for clickable text and such. Included is a new Clickable example, which is a little story that you can navigate through by clicking on the text. You can try it online.

    text-box-clickable.jpg

    Text Box 2 beta 3.0

    New: Added GetCharInfo, GetVisibleCharSequence, and GetInnermostMetaTag methods to TextBox. You can use these to support clickable text.
    New: TextBoxCharInfo struct, to provide some useful info about characters.
    New: Added Clickable example, which is a small text adventure.
    New: Added SetViewportOffsetFactorClamped method to ClipBox.
    New: ClippedTextBoxCollider3D component, for detecting 3D input on TextBox.
    Fix: ClipBox no longer allows scrolling when content is smaller than the viewport.
    Fix: ClippedTextBoxInspector now also shows Ignore Overflox Box toggle.
    Fix: Getting ClipBox.ViewportOffsetFactor when it hasn’t been initialized yet no longer throws an exception.
    Fix: Text Box style scopes now correctly work in combination with non-style meta tags.
    Fix: Eliminated shader warnings for Text Box Smooth Auto.
    Change: Restructured Text Box examples. Please remove the old Example folder.
    Change: Renamed CharType.Style to CharType.Meta.
    Change: Renamed Scrollbar3DInput to ScrollbarInput3D.
    Change: Renamed Mouse3DCameraToucher to MouseCameraToucher3D.
    Change: Moved material and texture from Clipping to Examples folder.
    Change: ClippedTextBox is now extendable.
    Change: ClipBoxScrollbar no longer overshoots when clicking the track.
    Removed: AutomaticParentSelector, which was already obsoleted and stripped from objects.
    Removed: Materials folder in Clipping, along with a pointless material inside it.
    Removed: Old debug statement from ClipBox.
     
    Last edited: Aug 12, 2014
  7. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    I spent some time away and doing other stuff, but now Text Box 2 updates have resumed. Beta 3.0.2 just arrived at the asset store.

    New: Added custom inspectors for TextMeshRenderer, TextMeshCylinderRenderer, and TextMeshTorusRenderer.
    New: TextMeshRenderer now has a Character option for secondary UV mode. It fits the mask texture over each character individually.
    Fix: Secondary UV generated by TextMeshRenderer in TextBox mode are no longer vertically negative.
     
  8. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    By popular demand, it is now possible to automatically shrink text to fit inside its box!



    TextBox2 beta 3.1

    New: Added shrinkToFit option toTextBox.
    New: Added fitPrecision configuration toTextBox for shrinkToFit.
    New: Added EffectiveTextScale property to TextBox to get the effective scale when shrinkToFit is enabled.
     
  9. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    I finally managed to get back to Text Box, and beta 3.2 is now available! It adds API for cursor data and comes with a new simple text editing example.

    New: Added TextBoxCursorInfo struct to facilitate cursor placement.
    New: Added methods to extract cursor info from TextBox: GetCursorInfoForPoint, GetCursorInfoForCharIndex, GetCursorInfoForUnstyledCharIndex, and GetCursorInfoForLine.
    New: Added toggle to TextBox to control whether styling should be used or not.
    New: Added "Text Editing" example, which has a simple ExampleTextEditor component, demonstrating basic text editing support.
    Fix: Closing bracket of style statement now also has its baseline adjusted.
    Fix: ClippedSlicedSprite no longer produces an error when no texture is defined.
    Change: The unstyled character index of meta characters has been increased by one. They are now the same as the next visible character.
     
  10. jjsonick

    jjsonick

    Joined:
    Sep 11, 2013
    Posts:
    18
    I bought this last night, and it looks great!

    Question about the Clickable Text demo: I see it relies on a custom cursor and a "hover" state to detect clicks. Can this work on touch devices without a custom cursor? Can you provide an example of the code changes so it could work both on desktop and touch device with just the system cursor or touches, respectively, registering as clicks?
     
  11. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    Thanks for buying, jjsonick!

    It actually works for touch devices as it is, although the design is awkward, with small hit areas.

    The minimum you need for touch is OnPointerDown. You can directly get the innermost meta tag there instead of doing it in Update, and directly use it to set the text instead of storing the active key. So you can get rid of OnPointerEnter, OnPointerExit, Update, and nearly all variables. You'd end up with something like the following.

    Code (CSharp):
    1.         public void OnPointerDown (PointerEventData eventData) {
    2.             string key = textBox.GetInnermostMetaTag(eventData.point);
    3.             if (key.Length > 0 && texts.ContainsKey(key)) {
    4.                 SetText(texts[key]);
    5.             }
    6.         }
     
  12. jjsonick

    jjsonick

    Joined:
    Sep 11, 2013
    Posts:
    18
    Thanks, that did the trick! If I use clickable text I think I'll do tablet-only, because I agree, it might be too awkwardly small of hit areas on a phone...
     
  13. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    A small requested release, TextBox2 beta 3.2.1, has just become available. It adds a component for clip box viewport dragging. Should make scrolling a lot easier on mobiles too.

    New: Clipping.ClipBoxDragInput3D component. Add it to a ClipBox object to support dragging the viewport directly, instead of using scrollbars.
    Change: ScrollbarInput3D no longer changes the original Z coordinate of its collider's center.
    Change: The Example Clipping scene now includes viewport dragging for both it snested clip boxes.
     
  14. eajones

    eajones

    Joined:
    Aug 1, 2013
    Posts:
    45
    Having difficulty getting textbox to work for me--which is because I am very much amateur at unity---I have purchased TextBox, looked at online docs and am still lost. I am trying to put some simple text (3-5 words) on a cylinder, have it rotate above an object showing only the text (invisible object) AND if possible to make it work like an effect where the cylinder radius increases over time then disappears (like a particle effect expanding outwards). I can't even get the text on to a cylinder... I know how to get things to rotate around y axis--but getting the rest accomplished is beyond me.

    Anyone able to give simplistic directions to get any part of this working?

    Thank you!
     
  15. eajones

    eajones

    Joined:
    Aug 1, 2013
    Posts:
    45
    OK, spoke a bit too soon--found cylinder example and can get rid of material and cylinder is transparent--

    Any way to make the cylinder expand over time and dissipate like a particle effect please!
     
  16. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    @eajones You can actually completely remove the cylinder object. The example has it just to visualize the space.

    There's two ways to grow the cylindrical visualization. Either you increase the entire object's scale or increase the radius of the box's cylinder settings component. The first option makes it expand uniformly, so the text becomes larger. The second option keeps the text size the same but makes it wrap around an increasingly larger shape. Either case can be done via a script by adjusting the relevant values in an Update method or in a coroutine. Something like

    Code (CSharp):
    1. private void Update () {
    2.     transform.localScale = Vector3.one * Time.time;
    3. }
    though of course you don't want to grow it forever.

    Fading out could be done by going through the renderers and adjusting material properties, but this is rather cumbersome. So I just added a tint to TextBox 2 beta 3.2.2, which you can update to right now. Reducing the tint's alpha will fade out the entire box. You do have to explicitly tell the box to render its text again though.
     
  17. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    We're now at TextBox2 beta 3.2.3. Two new features have been added recently.

    Text Box gained a tint so you can easily change the color of all its contents.

    A new alignment mode has been added, JustifyComplete, which stretches all lines. This in contrast to the regular Justify mode, which doesn't stretch the last lines of paragraphs.
     
  18. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    Just released beta 3.2.4 to add a circle renderer that someone needed. Small features like that might be added quickly, so don't hesitate to ask!

    circle-text.jpg
     
  19. sakati

    sakati

    Joined:
    Jan 5, 2013
    Posts:
    36
    @Jasper Flick What kind of text editing capabilities does this package have? Can you only type text or can you also mark the text via mouse and change the style?
     
  20. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    @sakati It is not an in-app text editor. You can do simply text entry with some work, but without selection ranges. With tags enabled you could edit styles, but it's awkward so I wouldn't expose that.
     
  21. charmandermon

    charmandermon

    Joined:
    Dec 4, 2011
    Posts:
    352
    does this support <sup> and <sub> html tags?
     
  22. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    @charmandermon No, those tags aren't supported. TextMesh Pro does support them though, so check that one out.
     
  23. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    hi!
    i m trying to make text on a curve but could not found any example , or any thing help full , plz can you provide an example for it?
     
  24. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    @aammfee Following a curve is not part of Text Box, though you could make it yourself with a custom renderer. However, this package is no longer in development.

    You could look at TextMesh Pro. It doesn't include text on a curve yet either, but there's some talk and examples of it.
     
  25. RazaTech

    RazaTech

    Joined:
    Feb 27, 2015
    Posts:
    178
    how i
    how i can make it ..?
     
  26. Jasper-Flick

    Jasper-Flick

    Joined:
    Jan 17, 2011
    Posts:
    957
    @aammfee I have no ready-made solution for you.
     
    RazaTech likes this.