How do I define a specific number in a blueprint variable and then in another blueprint take this value and display it in a textbox?
Blueprints are classes. You can’t “read the value from a blueprint.” You can “read the value from an object.” Blueprints can be used to create objects.
So, if you have spawned an actor from a blueprint, find that actor in some way (through collision/triggering, through get-objects-by-class, or some other mechanism) and then read the value from that actor, just like you’d read a value from any other actor.
If you don’t actually want to create instances of the class, the Blueprint is the wrong tool. You probably instead want a “simple data asset” which you can then create instances of, and reference as object refenreces.
You could also create a data table, with some struct that defines the properties of each row on the table, and then use some key field (a name, a value, …) as the lookup key in that data table.
Maybe you can start learn the basic way to blueprint communication
I have workaround for global variables:
- create blueprint function library (it is in dropdown menu under blueprints)
- create function that returns your value from variable
- declare local variable to that function, set its default value to what you need.
- make that function PURE
Now you have little node that always returns value you want.
You can get it step further:
- create function that returns you Game Mode reference
- there create “global constant variables” (I know silly name), now you can have all const in single place.
- modify first function to find game mode reference and read that variable from it
And you can go even further (what is i am doing):
- use C++
- create pure blueprintable function that returns value, benefit to this is that C++ will not randomly zero variable (like bp`s do sometimes) and you can have all constant values in declaration as TEXT, then function just returns it to bps