Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

How can I render placeholders inside Text to allow drag n drop on them

Discussion in 'Unity UI & TextMesh Pro' started by mustafamagdy, Aug 9, 2018.

  1. mustafamagdy

    mustafamagdy

    Joined:
    Sep 11, 2015
    Posts:
    2
    I need to render a placeholder inside text to allow drag n drop behavior on those placeholders as shown in this image

    upload_2018-8-9_20-40-28.png
     
  2. FernandoHC

    FernandoHC

    Joined:
    Feb 6, 2018
    Posts:
    254
    1. create the texture like you have above and import to unity as a 9 slices type.
    2. In your text object, make a new UI Image object with anchors of max stretch anchors.
    3. Change the left,right, top, bottom values to 5, or whatever you want the distance from the texture to be.
    4. Reference that object in your code and enable/disable through gameObject.SetActive(bool)
    5. You can detect mouseOver several ways, there are plenty of examples looking up on google
    let us know if you get stuck at some point.
     
  3. mustafamagdy

    mustafamagdy

    Joined:
    Sep 11, 2015
    Posts:
    2
    But how the image will be placed if the text length is not determined yet?