Trouble reffering to variables/blueprints between blueprints/mycharacter
The last few days I've been struggling hard with making the easiest thing possible which is:
Reading out a variable from one blueprint in the other and use this to trigger something else.
You'd say this is the easiest thing ever! Just make an object variable with the blueprint you want to target and get/set like in the basic tutorial but every time I do that I get the error the variable is empty even though it's a bool. I feel like I'm missing something really easy which nobody talks about due to it being so obvious but I don't see it!
So obviously I do something wrong! I've tried my hand in casting but get the same issues none the less. I've googled around and found people with similar problems but the projects and the solutions were either out of context or too complicated for me to grasp so what I hope to achieve with this questions is that somebody can help me on the most basic way possible so I can continue. I don't need to make very efficient scripting so if there is a simpler way but less nice please use that. Once I grasp the basics I can go deeper.
So how do I make the following work in the easiest way possible without me getting the error that the variable is empty? This should be a piece of cake for you guys but for me it somehow doesn't work and it frustrates me to no end!
I have a box in the room (basic blueprint with box mesh and nothing else in it's components) and my player character that comes standard with the project. My project is a blueprint project and the rest of the room is empty but the floor. The box prints out the status of a bool I set in my character.
I press Q to trigger the set of a bool I named TestRef (it toggles via a flipflop) which is editable
I made a variable called TestRef (also editable) that is an object linked to the MyCharacter_C blueprint and made an event tick that prints out the status of the bool via get TestRef(blue) -> Get TestRef(red) -> Convert to String -> Print
If I press play it prints out false but keeps doing that even if I press Q numerous times. Closing down the play it gives me the error:
"Error Accessed None 'TestRef' from node Construction Script in blueprint Box"
Or in other words it's probably empty and not defined. But how do I do this?
Any help is much apreciated as it's very frustrating being able to make more complicating stuff but not being able to make the simplest of the simple happen!
Can you show/tell where/how you set the value of the TestBox::TestRef variable? Presumably that's where the problem is - it's not correctly hooked up to the current instance of the MyCharacter class.
answered Nov 11 '14 at 04:48 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here