Can't I read C++ values from Widget Blueprints

Hi there,

is it possible that I can’t access any of my variable values from C++ in the EventGraph of a Widget Blueprint?

I tried the same in a normal class blueprint and the Boolean received it’s value “true” from the code, but it seams not to work from my widget. (The Event Tick and Print String Node are only meant for Debugging)
I also wrote a Getter in C++ and accessed that from the Widget, but also returned 0/ false…but the getter is actually returning true.

Do I have to access my variables different in a widget blueprint?

Are you trying to set up a C++ base class for a widget blueprint? If so, remember you need to reparent the blueprint to your new C++ base class (that derives UserWidget). Right now, the parent class of your blueprint is still UserWidget so it won’t have access to anything you’ve added.

Reparenting can be done in the File menu.

Nope, ABaseContainer is the baseclass where all kind of containers (plants, barrels, creates, chests, ect.) inherit from…all the widget has to do is to get a boolean value which is set to true once a view conditions are fulfilled (in pure C++).

Actually I can call the getter as well as the boolean variable itself, but the WidgetBlueprint can’t read it’s value a some reason.

Are there any counterparts for #include in blueprint or widget blueprints? I havn’t used the blueprint system a lot, since I prefer C++ in most cases.

I think something wrong with your object instance, are you sure that Ref Base Container is contains object that you expect? It does not matter from which blueprint you try to access something because everything runs on same virtual machine.

Thanks,

ReferenceBaseContainer is a pure reference to the ActorClass itself…Do I necessarily need to reference a Blueprint (Sorry if this question may seem a bit dumb).

I tried it with a reference to a plant Blueprint which is derived from that class and the variable is clearly set to true in the blueprint (by code) but the result is the same as with the reference to the class…it is callable but not readable…strange, I don’t get it.

Here is the code (public) which declares the variable.

UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Container)
bool bInventoryWindowEnabled;

Edit:

I’ve created a new clean testproject, created a testclass, made 2 Blueprints (one from TestClass and one from Actor). The testclass contains a bool and an int variable.

I referenced the Blueprint Testclass the same way as I did before and as it is done in this tutorial

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/BlueprintComms/index.html#simplewaytoreferenceatargetblueprint

both int and bool values are clearly visible in the BP_TestClass, but once I want to read them by the reference in BP_AccessTest(from Actor.h) the result is the same…you could call them but not read them (Failed to find variable property)

Could please anybody try to reproduce the issue? I’ll try it too in the lunchbreak on a difference PC