unable to change value of a variable from one blueprint in another
I am unable to change the value in one blueprint so across blueprints but in another below should be some photos. but then when i'm in the level and I press the [y] key it gives me the errors below.
PS: I personally think that Character HUD is pointing to None (ie it is not pointing a valid object)
answered Dec 09 '14 at 03:10 AM
Have you gone through the Blueprint tutorial videos posted by Epic in youtube? If not, then please go through it. Also it looks like you don't have much programming experience. Even though you can do blueprints without serious coding skills, you must have some basic understanding of how stuff work
This is the tutorial: https://www.youtube.com/playlist?list=PLZlv_N0_O1gbYMYfhhdzfW1tUV4jU0YxH
How ever you keep asking what REFERENCE is. I will try to explain it here:
When you are working with blueprints, a reference is not much different from a normal variable (Integer, Floats, Vector..). But when you switch over to a programming language like C++ they are entirely different. So if you are working with Blueprints only, you dont need to worry too much about it. In most cases, when we say 'reference' we only mean an instance of a Blueprint.
So in your case, you have a variable named 'Character HUD' of type 'Character HUD_C'. Now this only means that the variable 'Charcter HUD' can store and instance of 'Character HUD_C' blueprint. It DOES NOT automatically create an instance and point to it. That is your job. Before you can use the variable 'Character HUD' and access any member variables, you first need to make an instance of 'Character HUD_C' and Assign (Set) it to 'Character HUD' variable. Until you do this, the variable 'Character HUD_C' is empty (aka Null/None), ie it is not usable. This is where IsValid comes into play. IsValid is used to make sure the variable you access is actually usable.
So in your case to solve the issue, this is what you will have to do:
If the default HUD class for your game mode is 'Character HUD_C', then you should get a reference to your HUD using 'Get HUD' node and assign the returned value to 'Character HUD' variable. Ideally this should happen within 'Begin Play' event.
On the other hand, you are manually instantiating 'Character HUD_C', you should do ti within 'Begin Play' and assign the created instance to the variable 'Character HUD'
answered Dec 10 '14 at 04:31 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here