For anyone wondering what the website was for all the fonts here it is: www.dafont.com/theme.php?cat=303&page=3 Code for the tutorial can be found below! { public TMPro.TextMeshProUGUI myText; public int myScore; public RectTransform myRect; void Update() { myText.text = "Your score is: " + myScore; myText.fontStyle = TMPro.FontStyles.Bold; myText.color = new Color(1, 0, 0, 1); myRect.transform.localPosition = new Vector3(30, 80, 0); myRect.localScale = new Vector3(1, .5f, 1); myRect.sizeDelta = new Vector2(360, 600); } }
@Build_the_Future3 жыл бұрын
hope you keep going with Unity tutorials I'm really enjoying them. I hope you can cover, Animations, Ik, explain how and why to use quaternion, Animation stats, Animation controllers/avatars, blending, physics, How to speed up FPS, Useful assets on the store, Unity apps, etc.
@TheRoyalSkies3 жыл бұрын
@@Build_the_Future So glad to hear you're enjoying the content - You'll be happy to hear that the vast majority of those will be covered in the "Advanced Unity Animation Programming Series". It's probably gonna be in a month or two :)
@TonyAnima_Projects3 жыл бұрын
Nice tutorial of menus in Unity3D. Now just a small question. I've been trying based on some FPS tutorials and I had the idea of making the color for the magazine / clip to change from white to red when it is less than 3 and to gray when it is zero. However, after I coded to the UIController script of my mini-game, it didn't loaded properly. using System.Collections; using System.Collections.Generic; using UnityEngine; public class UIController : MonoBehaviour { public Font fontHUD; public PlayerBehaviour player; public static UIController instance; public AimUIBehaviour aimUI; // Start is called before the first frame update void Start() { instance = this; } // Update is called once per frame void Update() { } void OnGUI() { GUI.skin.font = fontHUD; GUI.contentColor = Color.white; GUI.Label(new Rect (Screen.width - 100, Screen.height - 85, 200, 80), player.weapons[0].currentAmountAmmo+" / "+player.weapons[0].currentAmountAmmoTotal); if (player.weapons[0].currentAmountAmmo > 3) { GUI.contentColor = Color.red; } } } Originally the currentAmountAmmo and currentAmountAmmoTotal were private classes and were picking up the information from ammoUsed and ammoTotal (public classes), but I had to change them to public while I was trying to test it. And I know I should share the other scripts in case you want to have some basic idea from what I was working on, but I'm still working at some intervals, which from one moment to another the scripts might be modified. In the future, do you plan to make a tutorial in how to code the text to change from one color to another by some conditions in Unity3D - like from white or other color when - for example: 30/30, yellow when 15/30, red when 3/30 and gray when 0/30? That will help for sure.
@IchigoFurryModder3 жыл бұрын
@@TonyAnima_Projects First of all, that's not quite how you do singletons, you need to check that instance is null before doing anthing, and it's good practice to do that stuff in Awake, like so: void Awake() { if (instance == null) instance = this; else Destroy(gameObject); //DontDestroyOnLoad(gameObject); // You usually do this with singleton components, like with an AppManager or GameManager class, but in your specific case I don't suppose you want that. } I'm guesing your problem is the label stays white? I'm pretty sure you're supposed to change the content color *before* rendering your element, try it like so: if (currNumber > 3) GUI.contentColor = Color.white; else if (currNumber == 0) GUI.contentColor = Color.grey; else GUI.contentColor = Color.red; GUI.Label(new Rect (Screen.width - 100, Screen.height - 85, 200, 80), $"{currNumber} / {maxNumber}"); But consider using the UI system.
@TonyAnima_Projects3 жыл бұрын
@@IchigoFurryModder Thanks for the tips and indications, Ichigo. That will surely help. :D
@nocturne63203 жыл бұрын
A few tips for optimisation. If you're going to change the text often (like a score display) don't enable the font auto size, instead just set the size manually. If you don't actually need the extra effects like outline or shadow, leave them unchecked in the material settings. Also as others mentioned, use String.format, or the $ sign with {} in strings instead of + and just use "using TMPro;" at the top of your code. Or if you're working with a lot of text you want to concatenate each frame, use the StringBuilder class and store it in a variable at the top of your script, don't just do "new StringBuilder" each time in the update method.
@issacthompson3303 жыл бұрын
The best part of TMPro is how much you can do with it with ease. TMP has a variable in its Info that tells how many characters of the text are visible so you can use an update function or a corutine to make it fill in the text as fast as you want.
@gnosisdarkmatter3 жыл бұрын
I got distracted after I read this. 3:28 "This is a paragraph. It's like, the best paragraph ever -" "This is the second paragraph. It's like, the second best paragraph ever -" "This is the last paragraph. It's totally the worst paragraph ever -"
@apatsa_basiteni2 күн бұрын
Still Awesome some 3 years later. Thanks.
@ArkTheDuckh3 жыл бұрын
Oh nice. Congrats on 100K btw
@TheRoyalSkies3 жыл бұрын
Thank you -!
@Antonybae3 жыл бұрын
Nice tutorial! "Your score is: " + myScore uses concatenation which creates 3 new string variables in memory. for strings its better to write: $"Your score is: {myScore}" which uses interpolation and creates only one string variable). Its not a big optimization but using '+' operator is kinda bad practice(especially in enterprise)
@TheRoyalSkies3 жыл бұрын
My mind is Blown - Thank you for sharing this, I didn't know that was a thing, I will definitely try and get into the habit of using this instead!
@MikeKing7103 жыл бұрын
Best exploration of what we have in Text Mesh!
@MarkChong3 жыл бұрын
This guy will save your time and NEVER WASTE IT
@WeeGification3 жыл бұрын
You mad lad, I've been avoiding TMPro because of not being able to use any Fonts, that font object conversion changed my life. I'd followed you for blender tips but I've been using unity for 2+ years so when you switched to intro unity tutorials I wasn't sure I get anything out of it, but here I am getting taken to school. Good stuff!
@TheRoyalSkies3 жыл бұрын
No problem man - I'm glad you got something new out of it, and thank you for sticking around for so long. If you've been here since Blender, you're probably a Legacy sub lol. It's good to see you guys in these vids :)
@WeeGification3 жыл бұрын
@@TheRoyalSkies Yeah man, some of the best tutorials on youtube, some of the only that don't waste your time. I heard you're gonna be making more advanced unity stuff soon, looking forward to it. Keep doing what you're doing man
@noirlavender64093 жыл бұрын
Thank you man. Once I get out of poverty because of your wisdom and awesome tutorials I'll put your name and links on the credits
@paulorodriguez62883 жыл бұрын
yes this is the quick info a beginner like me needs. thankyou
@CleisonRodriguesComposer3 жыл бұрын
The best tutorial about Text-Mesh-Pro! Thank you!
@mynameisearlbАй бұрын
I just learned about TMPro and this was the video i needed, thanks!
@ColdOneK3 жыл бұрын
For using Text Mesh Pro w/ script, you can add using TMPro; For creating font assets, I tend to add a bunch at a time, so I go Window/TextMeshPro/FontAssetCreator -- add your font - generate font atlas - then save -- you can then drag the created file to where you keep your fonts, so if you want to use that font in another project, you can simply drag both the font + the font atlas file into the new project.
@FlappyBandAid3 жыл бұрын
Man THANK YOU! Worked like a charm!
@CreativeSteve693 жыл бұрын
I love coming back here for help as I"m making my first simplistic game. :D
@pixspaces47773 жыл бұрын
Really helpful, I knew about using TMP for static text but using it for score system always gave me errors and bugs, thanks a lot for simplifying it! Also congratulations on 100k+sub!
@flicker_1173 жыл бұрын
AYYY...100K
@TheKnightDark3 жыл бұрын
As always great tutorial. Thanks!
@vellyxenya39703 жыл бұрын
Congrats on 100K!!!
@UnderfundedScientist3 жыл бұрын
keep up the great work
@Thesupperals3 жыл бұрын
Yo. Don't forget to tell the script that you're using Unity's TMP library. This will help you access a all of things that TextMeshPro offers that you otherwise wouldn't be able to access.
@IchigoFurryModder3 жыл бұрын
And if you're using assembly definition files *as you probably should* don't forget you need to reference TMP in there
@animatrix14903 жыл бұрын
Thank you so much for making these
@kriegs83153 жыл бұрын
yes
@Hyphen33723 жыл бұрын
thanks
@CrimsonGamer233 жыл бұрын
Let’s say I’ve designed some number for score and I have them set up individually as a png. Can I use the png or set them up as fonts?
@TheRoyalSkies3 жыл бұрын
You can use the png if you want. If you have a png for each number you could have an array of each png, and set them to appear based on the number for the score -
@CrimsonGamer233 жыл бұрын
@@TheRoyalSkies Thanks!
@Caden_Burleson Жыл бұрын
@3:35 Same 😂
@officialsquadrilogystudio3 жыл бұрын
Game coding reminds me a lot of algebra class
@kittentacticalwarfare11403 жыл бұрын
The Aliens are *AMOGUS*
@technofeeliak3 жыл бұрын
You had 69 likes. Sorry to ruin your fun but I added one.
@TheRoyalSkies3 жыл бұрын
I legit almost chocked on my coffee reading this comment - Haha, It's OK to ruin my fun if it's for the good of the channel -!