Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. We're looking for your feedback on the platforms you use and how you use them. Let us know!
    Dismiss Notice
  4. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  5. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  6. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  7. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  8. 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 at 6:42 PM.

  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:
    134
    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?