Context sensitive variable 4.6

I’ve read that going forward all variables may need to be “public” in order to access in other classes. I personally don’t understand reason for this. If someone can comment further on this ?

So currently I’m setting all my variables to public so I can references them in other classes, how ever I’ve noticed a few extra bugs on top of this :
when dragging out from Cast To → Failed → it can’t see any of my blueprint’s variables or functions

Someone else asked about not seeing their variables correctly. answer was:

With 4.6 you need to make those variables Public in your character BP in order to acces them via casting.
by Jacky (Can't access variables in 4.6 - Programming & Scripting - Epic Developer Community Forums)

What do you mean by dragging out “Cast To → Failed ->”? I can’t check if node has changed, because i don’t have 4.6 at moment. So if you provide me with some more information, i may be able to help you.

Hi ,

As I mentioned in ], variables in 4.6 need to be marked Editable (public) to access them in other Blueprints. developers are checking to see best way to handle this, but my understanding is that this is intentional. General coding practice is to leave variables private in a class unless you need them to be accessible, in which case you explicitly mark them as public so that other classes can access them. Though Blueprints operate somewhat differently than classes in code, that’s general structure they are emulating. Making it necessary to explicitly state that a variable is public before being able to access it in another blueprint makes more sense if you think about it that way. It can be dangerous to have all your variables accessible anywhere.

I’m a little unsure what you mean about your second issue. Cast Failed output on a Cast To node is an execution output, and as always you need a specific reference to cast to another Blueprint. As output from a Cast To node is where you normally get your reference to other blueprint, and where you need to pull off to get a variable inside that blueprint. Am I misunderstanding what you’re doing or what you’re trying to do? If so, would you mind including an image for us? Thanks!

Hi , to be fair I’ve been coding a lot recently in javascript, lua and python which don’t really care about public vars etc… But after reading this I do get it. I guess I also got use to current blueprints behaviour
As for my Cast to bug :

Hey ,

I’m seeing same thing. I did a search through our bug report system and found a similar issue was already reported [UE-6090], and I have updated it with information you’ve provided. For now, unchecking Context Sensitive should work. Thanks for report!