I have been working on my game since the release of UE4 last year. I had to take about four months off, due to other obligations. Now I am back, and ready to jump back in. I just downloaded the newest update, and am still having trouble with something I had before.
Most tutorials that I follow have what ‘appears’ to be a simple tasks. Create a variable in one blueprint, and click the ‘eye’ so that it turns yellow. I gave up on trying to method in the older version, but I was hoping it would be fixed by now.
I just opened some new tutorials that include, yet again, exposing variables between blueprints. I still can’t see them in other blueprints. I have tried multiple variations, and even created new projects to see if it could be a bug in my current code.
Could someone please give me some insight into what could be happening? I really hope I am just missing a step somewhere. I’m sure everyone knows how increasingly important it becomes to link variables through separate blueprints.
Exposing a variable just exposes them to the world, not to other blueprints, and ticking the eye thingy just makes the variable public instead of private. That means that by getting a reference to that blueprint into the world you can get its variables from other blueprints. You cannot get the variables of something that is not in the world yet.
Here is the tutorial in question. They don’t have any additional steps from what I explained.
"Firstly we should add new variable of bool type. I called this “canRotate” cause this variable will allow or not to a user rotate an object. This variable will connect to our new sub-Actor class. Then right click on Graph space and choose Event Actor on Clicked from the context menu. This event will occur when a player press our object. OK, next drag and drop a canRotate variable from a panel to a Graph space. A context menu will appear, choose Set item from this. A new block will appear. Check canRotate and connect this block with an Event Actor on Clicked event.
We should return to Level Blueprint again. In this graph we already have one block – InputAction MouseClick event. Next from Released node drag out a fiber to create “set canRotate block”. It must check off a rotatable object’s canRotate variable."
This isn’t the first time I have had this exact same problem.
Might sound rude, but I think you don’t know what you are doing. If you want to get a variable from an actor, you don’t need to expose it, just make it editable and then use a reference to the object to obtain or set it.
You can also do this from the blueprint itself, you don’t need to do anything in the blueprint level unless it’s level-specific stuff.
Exposing variables to the world is only useful for already running code. Like for example you could make a wall and have a integer so you can edit in the level how many batches of a wall you want in vertical or horizontal. Or if you have some script to make the actor display a number, change that number in the actor properties.