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.

charachter hud is an variable object that points to the actual blueprint named charachter hud

and when i tried the things you suggested
i still get this error

23396-cap16.jpg

Check these:

  1. Make sure the variable ‘Character HUD’ is valid is points to an instance. Use the ‘IsValid’ node for this.
  2. Instead of setting the variable, try printing out its value to see if you can actually access it.

PS: I personally think that Character HUD is pointing to None (ie it is not pointing a valid object)

you need to check IsValid before the printString node, because that print string grabs data from your reference variable without checking it, which means it might be a null pointer, and if you never set it, than it definitely is a null pointer.

you should always use IsValid to check object references/pointers before using its data or functions. and if the reference is invalid, maybe that is a good time to try to set the reference.

23388-checkyourpointers.jpg

i still dont understand what do you mean???!!! and what do you mean by set the reference?!

Did you use IsValid node before trying to access the variable? Also you need to assign a valid reference to an object to the ‘Character HUD’ variable. ie simply creating the variabale and setting its type wont make it work. At some point you manually need to ‘Set’ the value of ‘Character HUD’. Only then can you use it.

okay well i got this when using the is valid function so here

and i just switched it up a little and added this little snipit before everything else

thats still wrong. your printString node references a variable from ControllerHUD, so the exec input connecting to the print string should be connected to the IsValid output. you are still accessing potentially null reference variables.

i still dont know what you mean by setting the reference and im not changing the value of charachter hud im getting a variable from that BLUEPRINT and trying to change its value

YOU ARE NOT GETTING WHAT IS GOING ON! i am not trying to print the value of battery charge level when the object is valid i want it to print it out no matter what so now when it prints it out its zero so when it does read the variable it will print 100 so i know its working

and what do you mean by REFERENCE VARIABLES???

CAN SOMEBODY JUST TELL ME WHY THIS IS HAPPENING AND HOW TO FIX IT!!!

your error says access none, that means your reference is Null or Empty. references are the same thing as the light blue pin variables in the graphs, and it is the same thing as a c++ pointer, these blue pin objects need to be checked using IsValid. IsValid checks if pointers are null. if they are null, you cant access their data because they don’t point to any data. you need to assign your variable/pointer/reference/bluethingy, and to do that, you use the set function.

reference variables store the memory address of an object. they are the light blue variables.

the photo you attached as part of your question uses a set function. you were setting an integer. setting an object pointer or setting a reference is the same thing. an object reference is the light blue variable type. its like an integer or a string, you have to set its value to something in order to use it.

OK but i don’t get what i have to do to fix this the object variable ‘Character HUD’ is a object of the blueprint ‘Character HUD’ and it points to ‘Character HUD_C’

can you please be more specific i dont understand are you talking about ‘Battery Charge Level’? or the charachter HUD object variable how how would i use the “set function” for this?