Help Changing Alphanumerics of text inside a Canvas

I can’t figure-out why the “Score” is NOT changing, although the command-line does not generate any errors on a build and it does not halt execution.

Here is the code that called the function that is supposed to update the score and print it on Canvas2.

And here is the function inside Canvas2 inside Dragon:

Here is the console print-put of you want to follow the order-of-execcutiom.

And this is what The Parent of Canvas2 looks like with SoreText:

And suggestions on hunting down this glitch?

can you paste the text script?

Here is the TextScript:

Quite possibly not the issue, but in your first screenshot, in the OnCollision2DEnter you have a semi-colon after the opening curly brace in the If statement.

Also, in Text Script you are Destroying the game object and then trying to access it, I appreciate you have a five second delay but why? I would suggest it could lead to future issues with the code that way around.

Your inspector view for Dragon shows score equalling zero. Unless you have something else setting score to a different value each time you run this score will always be zero, then you set you TMP of 100 and add it to score. Thus score becomes 100, everything. As I mentioned, unless you have something elsewhere setting the value of score?

The Score Text is set on line 60:

Hi, score, not ScoreText

I haven’t implemented a Hi Score yet, ScoreText is the total number of points the player earned,
but I haven’t been able to get it to update.

chuckle - that was me saying “Hi”, not “Hi score” :slight_smile:

Good News, I have it working.

The problem was that Score Text was pointing to a Prefab instead of the one on screen,

1 Like

Good find! Glad you’ve got it sorted Dan :slight_smile: