Sprites inside your text boxes! How to use sprites in Unity Text Mesh Pro

Поділитися
Вставка
  • Опубліковано 23 гру 2024

КОМЕНТАРІ • 88

  • @ChristinaCreatesGames
    @ChristinaCreatesGames  2 роки тому +4

    Download the sprites from my Google drive here: bit.ly/Flower_Sprites

  • @JoltJin
    @JoltJin 5 місяців тому +2

    4:05 you can add sprites in if you add them to the base sprite sheet.
    Then in the sprite asset inspector, hit Update Sprite Asset near the top to have other marked sprites in the sheet get added in like the originals.

  • @flamingpenny
    @flamingpenny Рік тому +4

    Clearest and most in depth explanation on the topic I've seen so far. You got yourself a subscriber.

  • @RayzDEV
    @RayzDEV 6 місяців тому +1

    IDK why other videos were over 30 mins for this, I glad you covered this in 5 mins

  • @MagicPigGames
    @MagicPigGames 2 місяці тому +1

    It was harder than I thought, which is why I'm here :D

  • @pavlovsdoguk
    @pavlovsdoguk 2 роки тому +4

    This was amazing. You are so knowledgeable about TMP and it shows.

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  2 роки тому +1

      Thank you ❤️ I love typography and I feel like there aren't enough tutorials on that in our game dev corner of the internet :) I am super glad people find value in my tutorials!

  • @alexleonardkrea
    @alexleonardkrea 2 роки тому +1

    Again, I'm saving this one for later! Thanks Christina, great job!

  • @PitiITNet
    @PitiITNet 2 роки тому +2

    And again I learnt something new! Amazing content. Thank you Christina!

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  2 роки тому +1

      Glad it was helpful! This video was fun to make :D Put a new topic on my upcoming list, too!

  • @alon_vita
    @alon_vita Рік тому +8

    Multiple sprites' pivot can be changed using the 'Slice' drop-down menu on the top-left 🥳
    You can set the 'Pivot' of all sliced assets in the drop-down menu 🔥

  • @sibbyeskie
    @sibbyeskie Рік тому +1

    Great job making it simple and quick!

  • @darkmaigo
    @darkmaigo Рік тому +1

    Very exciting tutorial! Thank you for making it :)
    I want to ask what's that window that pops up at 5:02 ?

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  Рік тому +1

      Glad you enjoyed it =D!
      The window is Windows 11's clipboard. It's super handy! You should have a message pop up if you hit Win+v about enabling it if you haven't already. If you google "Clipboard Windows", you'll quickly find the official page on how to enable it and how to work with it :) I really wouldn't want to miss it anymore.

    • @darkmaigo
      @darkmaigo Рік тому

      @@ChristinaCreatesGames Awesome! Thank you so much! :)

  • @midniteoilsoftware
    @midniteoilsoftware 9 місяців тому +1

    Thanks Christina. I'm using this in my latest project.

  • @MiTheMer
    @MiTheMer 2 роки тому +2

    Nice and compact tutorial. Thank you :)

  • @yoko-kun
    @yoko-kun 2 роки тому +1

    Another great tutorial :) This might come in handy someday!

  • @amazinggamers356
    @amazinggamers356 Рік тому +1

    Really nice , this tutorial was very helpful

  • @whaptoovy3663
    @whaptoovy3663 Рік тому +1

    Thank You! This video saved my time!!! (and also saved me!)

  • @guru_laghima
    @guru_laghima 9 місяців тому +1

    Sweet, thanks!

  • @edin.
    @edin. Рік тому +2

    4:02- 4:06 not sure what you meant, but I was able to add a new sprite to my "sprite asset", I first created an image in gimp : 10'240 x 1024, (each sprite is 1024x1024) and I only drew 5 sprites (out of 10 spaces I had), I needed to add a new sprite, so I just drew 1 more in gimp, saved/replaced the 1st png file in unity, then in the "sprite editor" I added the new image, and then in the "sprite asset" I pressed the "Update Sprite Asset" (3:19 top right you can see it) button which is all the way at the top and it added my 6th sprite, maybe I missunderstood what you meant if not then you can add new sprites to the sprite asset this way. Very good tutorial though !

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  Рік тому

      Thank you so much for the feedback =D! Yes, you are correct - adding one in the file works. I was more refering to the + and - buttons, which (at least the last time I checked) deleted or douplicated a sprite instead of the "+" giving the option of adding a new sprite from the project's art folder, for example. But good workflow =)!

    • @darkmaigo
      @darkmaigo Рік тому +2

      Good catch. I tried adding more sprite sheets each of them has its own "sprite asset" and assigned them under "Fallback Sprite Assets" in the default "sprite asset" that I assigned in the Project Setting >> TextMesh Pro >> Settings >> Default Sprite Asset .... I don't know if there's a downfall to it but all of them works fine and I can add more sprite sheets without replacing each time

  • @kyleoneill6806
    @kyleoneill6806 Рік тому +1

    Thanks a lot for the video! This was super helpful

  • @MarekNijaki
    @MarekNijaki 2 роки тому +1

    Awesome and very useful video!

  • @yashaswiification
    @yashaswiification Рік тому +1

    thanks for the video!! that was really awesome it's really saved a lot of time :)

  • @PoRtCuLLiSuk
    @PoRtCuLLiSuk Рік тому +1

    Very handy. Thank you.

  • @PaniniDev
    @PaniniDev Рік тому +1

    This is so good

  • @reggiechou392
    @reggiechou392 7 місяців тому +1

    Great tutorial of textmesh pro

  • @ibmagar6188
    @ibmagar6188 2 роки тому +1

    works good. thanks!

  • @fangwilly2086
    @fangwilly2086 11 місяців тому +1

    Thanks for the video.😀

  • @aliengarden
    @aliengarden 2 роки тому +1

    Instant subscribe, great video!

  • @Droppa1
    @Droppa1 6 місяців тому

    Can you combine this with your TMP Material preset video and make one on using a custom shader in sprites to have an outline on text and outline on sprites in the text?

  • @sadbuttrue666
    @sadbuttrue666 Рік тому +1

    I'am using TMP since years.. but I don't know! Ist is great. Thank you very much.

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  Рік тому

      Glad you enjoy it! I have a big playlist on TMP features, maybe there are more things in it that are new to you ;)? I have a few on clicking, hovering or calling events based on the link tag, for example :D

  • @libiroli
    @libiroli 2 роки тому +1

    Hi Christina, thanks for the nice tutorials. Is it possible to detect when the mouse is hovering over a TMP sprite? I would like to display a tooltip in such situations. And to trigger the tooltip I need to know when the mouse is hovering over a sprite. I figured I'd ask the TMP expert! Thank you again.

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  2 роки тому +1

      Sorry it took a while to answer, stressful weekend 😉
      In fact: Yes you can! You'll need the TMP_TextUtilities.FindNearestLink() function and the tag.
      The "how" is a bit more in depth, but if you can wait a few days, the tutorial on using the link tag for just this use case is scheduled for the 6th of December 😊👍

  • @frederickfreund1957
    @frederickfreund1957 Рік тому +1

    Thank you for the nice vid! :)

  • @KasperDevUnity
    @KasperDevUnity Рік тому +1

    Thanks for the video.

  • @dmytromahas3562
    @dmytromahas3562 Рік тому

    Thank you for a lesson, but I have one question, how can I unselect maskable property in TMP icons ?
    Note: I can see this property only in Debug Inspector, but I can't change it, everytime this revert my changes...

  • @TheHighlander71
    @TheHighlander71 Рік тому +1

    Hello Christina. Thank you for your tutorial.
    I have a question though. I am attempting to dynamically change the text attribute of the TextMeshPro object to alter the sprite asset. My problem is that once I change the text attribute, the TextMeshPro object displays the text literally and no longer renders the sprite asset.
    Do you have any idea if what I am trying to do is even possible?

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  Рік тому

      Hi there =)
      Did I understand this correctly:
      You have a text like "" in your textbox. You want to change that to "" at runtime, and the words change but the new sprite is not being shown and instead you read the actual "" in your textbox instead?
      If so: Have a look if you named your sprites correctly, if you saved them correctly into the TMP Resources folder and if they are part of the same Sprite Asset. If they are in different assets, you'll need to tell the tag about that. Have a look at this tutorial if you are working with multiple Sprite Assets, I'm going more into depth about it there: ua-cam.com/video/JdGgrMWIknE/v-deo.html
      I hope any of this helped =)? Please let me know!

    • @TheHighlander71
      @TheHighlander71 Рік тому

      @@ChristinaCreatesGames That's correct. I change my sprite name from "healthbar_0" to "healthbar_1". I'm quite sure that I am getting the sprite names correct: when I type that exact name into the text box during runtime it works correctly. It just seems like the TextMeshPro object needs a refresh to parse the text and it doesn't do so automatically.
      Maybe the object has a redraw or refresh function that I have to call after I change the text.

    • @TheHighlander71
      @TheHighlander71 Рік тому

      @@ChristinaCreatesGames I've just spent some more time looking into this. It appears that directly manipulating the .text property of the TextMeshProUGIU game object doesn't work. You have to manipulate the TMP_InputField.text attribute.
      I've yet to figure out how to reference that, but that seems to be the answer.
      Currently my script is attached to the player game object and I'm trying to change the text inside a OnCollision2D event handler. I believe the InputField.text is a protected member of the TextMeshProUGUI class, so perhaps I have to move the OnCollision2D() function to the actual TextMeshProUGUI object.

    • @TheHighlander71
      @TheHighlander71 Рік тому

      @@ChristinaCreatesGames I've solved it. When I use tags like instead of their names it just works.
      I noticed that < sprite = 0 > (not the spaces) does not work. My guess is that the parser TMP uses is a little wonky. Thanks for listening.

  • @clashwithtrippertv2650
    @clashwithtrippertv2650 3 місяці тому

    can i also make it so if i press alt for example that the icon gets disabled and the name of the icon stands as text there?

  • @FurbyOfDeth
    @FurbyOfDeth Рік тому +1

    this was amzaingling good. i tryed watchign 2 other videos about this but they were over 15 min long and the dialog was awflue. Great job on this vidoe (probably will watch you one about stiles cus that looked cool)

  • @lappenjr.2506
    @lappenjr.2506 9 місяців тому +1

    Is there a way to add a dropshadow or outline to the icons?

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  9 місяців тому +1

      I never tried, but I'd recommend adding the effects you want to have to the sprites themselves. That would be the easiest option 🤔

    • @lappenjr.2506
      @lappenjr.2506 9 місяців тому

      thx for the quick answer, I sth else as a workaround.
      It seems you can not apply effecta beyond tint to tmp sprite assets. But you can make a tmp font assets from your spritesheet, and assign it as a fallback font to the original font your using. Then you can reference the icon sprites from the fallback font with unicode characters, and use alls tmp effects with them. The downside is, you cant use color in the sprites themself.
      In my case, that was the best fit. I use icons with pop up damage numbers, to indicate different damage sources.

  • @Badshaflim
    @Badshaflim 2 роки тому +1

    Works well!! DANKEEE

  • @sergiovieira4869
    @sergiovieira4869 2 роки тому +1

    Help me please! I can't even display Unity default sprite (emoji), I'm using index ""(i've also tried ), but it shows the text, not the image.

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  2 роки тому

      Hi Sergio :) TMP is a bit finnecky with how the tags need to be written. Give this one a try: . You need to remove the empty spaces around the equal sign and it should work. Please let me know if it did!

    • @sergiovieira4869
      @sergiovieira4869 2 роки тому

      @@ChristinaCreatesGames It didnt work unfortunaly.

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  2 роки тому

      @@sergiovieira4869 Hm, that's a bummer. Alright, deep dive time.
      Go to Edit->Project settings->TextMesh Pro -> Settings and scroll down to your default sprite asset. Does it show that it is missing? If it is, set it up once more.
      Did you save your Sprite asset into the correct TMP Folder? That's Assets->Text Mesh Pro->Resources->Sprite assets. It won't find it if you saved it somewhere else.
      Have you tried writing (without any empty spaces)? Did it change anything? What happens if you don't try to get it via ID but via name? You can also try writing it like this: to force Unity to look for it; the asset still needs to be in the correct folder (though if you're trying to get the smilies to show up, I guess they already are). Lastly, you can set the asset you want to use as the one the textbox should be using (I only recommend using this strategy while searching for a bug, though!). Go to your TMP Component and click on "Extra settings". There's a space where you can drag your sprite asset into. Try again with the different methods of using ID, name, etc. Does the problem persist?

    • @sergiovieira4869
      @sergiovieira4869 2 роки тому +1

      @@ChristinaCreatesGames I've found out the error. Tysm for your help! Great Video!

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  2 роки тому

      @@sergiovieira4869 Glad to hear you were able to fix it 👍

  • @NorthFolkStudios
    @NorthFolkStudios Рік тому +1

    Is there way to increase the scale of all sprites on the Sprite Asset? I'd rather not have to increase each individual sprite on the atlas by the same amount

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  Рік тому +1

      Sorry, this slipped me somehow. Yeah, you can scale all the sprites in an atlas at once! If you go to the overview where each sprite is being shown and you can set its size, rotation and place, keep scrolling down. There are values that change the values for all sprites in the asset equally :)

    • @NorthFolkStudios
      @NorthFolkStudios Рік тому +1

      @@ChristinaCreatesGames Thank you! I assume you mean the "Global" settings. Completely missed those. Thanks!

    • @ChristinaCreatesGames
      @ChristinaCreatesGames  Рік тому

      @@NorthFolkStudios Ah, yeah! I had Unity closed already when I typed that out =D Glad you found it anyway!

  • @MrBen-e6y
    @MrBen-e6y 2 місяці тому