This score is currently being printed to the screen for debugging purposes.
In UMG for my HUD, I’m grabbing a reference to the score and instantiating it in the UMG blueprint as “Current Score”. I set this each frame with Event Tick. I also have the text content binded:
However, even though I see the score updating in the print string text, the UMG text block is not updating, and stays at zero. Did I set this up incorrectly?
Well this is interesting, although the Print String node within my scoreHolder blueprint is reporting the scoreVar changes, doing the same thing from the scoreVar’s reference in my UMG graph is producing all zero’s.
Also interesting: In my Output Log, I’m getting a whole lot of
“LogScript:Warning: Accessed None ‘scoreHolder’
uiDesign01_C /Engine/Transient.UnrealEdEngine_0:LocalPlayer_100.uiDesign01_C_6
Function /Game/UI/uiDesign01.uiDesign01_C:ExecuteUbergraph_uiDesign01:004A”
Yop, your scoreholder is NULL i guess. Check it with the “Is Valid” node.
If you have your scoreholder in the scene you can click on it and after you selected it, you can rightclick inside the graph and click on “get reference” or something. I guess it was done like that.
“I’ve created a variable with the type set to the object scoreHolder_C. Then I drag the out pin off to get the “scoreVar” variable.”
So you never set the scoreholder to this variable. It is empty.
Getting an “Is Not Valid” fire on my scoreHolder reference. I can’t seem to reference it the selection way though, as it doesn’t give me the option in the UMG blueprint.
Ok my fault. Is this the only BP of that ScoreHolder class?
Than you could try getting it with the “Get All Actors Of Class” node and only select the first element of that array. Because you have only one actor of the score holder class, it should be at index 0.
How should I get an instance of it to plug in to the set node? I grabbed a set node for the scoreHolder var, but not sure how to plug in an instance of the actual object.
The easiest would be like eXi suggested to use the “Get all Actors of Class” node and select your Blueprint. You could also pass it down via other blueprints or use an interface in your UMG blueprint which takes your object as input and sets it to your variable.
However I personally would suggest not updating the score in a separate actor blueprint but rather doing it in the GameMode blueprint. It sounds like a very GameMode type of thing to do ;D
And a reference to that is easily obtained. Just use “GetGamemode”.
Though providing both should ultimately be the best thing since it shows what the general problem in the way of thought was as well as an overall better and easier solution
You are definitely correct though and seeing you all around the Hub you definitely do your very best to do so!
Alright so you’re almost there. Once you used the “Get Gamemode” node you have the current gamemode. However the system is only acknowledging that you a gamemode instance. Not your gamemode so you can access all basic functions inside the gamemode class but not yours.
To solve this you have to use a “Cast To” node which basically checks which class your current gamemode is. The one you select in a dropdown menu inside of that node or something else (basically a branch for classes).
Just drag out a wire from the “Get Gamemode” node and search for “Cast To”. You should find “Cast To (your gamemode name)” in that list
If you can, yes. You can create just like all other classes. There should be a parent GameState class. I think you need to set it inside the project properties where you also set your gamemode etc. There should be a section at the end after the gamemode for the gamestate class.
This class should handle your overall game. Scores, playerlists etc
Na, only because i’m spaming the HUB doesnt mean i’m all correct.
I just try to help with the easier problems and with questions no one seems to answer. (: You were right with the GameState. I thought about it to but i also thought he would know about it and needs it this way.