I’m not sure if you fixed this or not but the way I did it was go into the text and deleted the textmeshpro in the inspector. Then add a text with add component. That should fix the problem
I know this is an older video, and I'm still new to coding so I don't know how scalable this is, but if you're looking to make the score values different depending on the action (ex: killing an enemy is worth 50 points, picking up a coin is worth 5, etc) just do this: public void AddPoint(int pointValue) { score = score + pointValue; scoreText.text = score.ToString(); } and then when you call the function in another script, use a public int that you can call whatever you like, and set it to the points you're looking to reward it with and type out the function to replace the "pointValue" int with your new int, like so: public int points = 10; **Put this wherever you need to call it** ScoreManager.instance.AddPoint(points);
Thank you! This is exactly what I needed. You even made it simple enough to understand that I was able to make a few adjustments to make it fit what I was going for all while gaining an understanding of what I was doing to make it work.
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Points : MonoBehaviour { public Text scoreText; public Text highscoreText; int score = 0; int highscore = 0; void Start () { scoreText.text = " POINTS: " + score.ToString(); highscoreText.text = "HIGHSCORE: " + highscore.ToString(); } // Update is called once per frame void Update () { } }
Nice viedo man! I would like to ask how to keep the score to the next level for an example. Player has 150 score passes one level and have 150 still and once he dies it will reset to 0. Thank you
hello! can someone please answer quick question asap? I cannot seem to drag the score and highscore texts into canvas script manager variables? I am using text mesh pro and the canvas is set to world overlay. Not sure if that makes a difference though as I cant do it it any other overlay as well Thank you!
@@jessnam I liked how you replied the solution, not many people do that so ty, idk the issue im a newbie at this stuff and im not upto that but if i were to get that issue or others we know how to solve it thanks to you Have a great day stranger :)
I solved the problem if you still have it after 4 months is you need to remove the textmeshpro component and search for the text and add it as an component then you can drag it
Hi Coco code👋, how do you write a script sequence to destroy all the gameobjects, like 10+ gameobjects by assigning number order for each of one in runtime then press button to destroy it in sequence. THANKS 😊
Yes: - max 10 keys updates at once - max 300kb of a data for one player - max 10 updates per 15 seconds You can check all limits in PlayFab -> Select your game -> title settings (gear icon) -> Limits
How to create the Points to collect? Im bit stuck..The counter doesnt get up if i destroy or collect a object.. is there a other Video to create the coins ?
Great job! This tutorial ended up working well for my needs. I do have an issue though. I have different scenes with different setups so the high score for each level would be different. How can I separate the high score per scene?
@@qualix7 maybe you can add some level manager that have a variabel about each level high score Example Int level 1 = 1627: After finish level 1 you can save that new score to the variable. On start scene. Load the variable and show into gui But dont forget about performance
@@thatoneguy1296 when using text mesh pro the variable type Text is not compatible, you must use TextMeshProUGUI, as in "public TextMeshProUGUI scoreText;" for example
is there a setting Called Program*, its default is set to *Agressive TEwNice tutorialch is making that sNice tutorialtty static soft, change that one, once to
I know this is an old video, but still wanna try my luck, I have a different scene which I have to show my current score in the game over scene, how can I transfer the current score from the gameplay scene to my game over scene?
Errrr, where did that second script come from? Is it already part of the player controller? Where is it applied? Can I just make a tokenInstance script and add it to my current player controller? Comprehensive tutorial until that point.
Hi, I know it is a 2 year old video, but how do I edit the unity 2d microgame so that the level doesn't start again with some of the gems collected, but rather restarts the whole level? Kindest regards
instead of the "public Text scoreText;" line you should write "public TextMeshProGUI scoreText;"(the same with the highscoreText too). Also you should implement (aka put on the top where the using UnityEngine bulletpoints are) "using UnityEngine.UI;" and "using TMPro;" after all the others. Hope it works!
this is by far the most helpful tutorial I've found, I actually finally managed to figure out how to make my score script work for my first-ever game project. Can't thank you enough!!!!!
Hi, how did the score appear at the end game? For me, once my monster die, it doesnt appear, i need to stop playing so as to see the high score, please help me
Thank Coco Code! I have been trying to get a score script to work on a project that I am building. I had a very basic score script that I had coded but for some reason, it would not reset the score. This script worked the best of all the tutorials I had followed. I appreciate it!!! Keep up the great work!!!
question, does this also work with a stop watc/timer type scoring system? *example having a high score of 1 minute and 13 second, and storing that in a new panel with a UI called best time (highscore) of 00.01.13 seocnds* or something like that *the stop watch/timer im refering to/using was the same from your other video where you teach on how add a timer on the scene*
yes, just use a float instead of an int and when passing the record value to the UI apply the necessary math to convert to readable time, 00:00.00 for example
Thank you. Tried a bunch of systems that didn't work, but this way did the trick. I thought about increasing the points through a method in one script, but not like this (gonna admit I didn't think about making the method public ;_;), and had never thought about doing .this on the awake. Thanks again.