How to change c++ variable in blueprint

I’ve created a custom C++ class that has some variables in it which I’ve exposed to blueprints like this:

       /**How fast we move*/
    	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Custom)
    	double LinearSpeed;

However when I drag the class into the editor, or create a blueprint based on the class I am unable to change the value. I’ve tried changing the value directly on an object in the world, as well as through the blueprint editor. It just looks like this:


What am I doing wrong?

I can’t test this out myself right now, but maybe it’s a problem with the access modifier?

i.e., by default, if you don’t specify a public:, protected: or private: section, everything will be private.
Maybe you can try the following:

public:
    /**How fast we move*/
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Custom)
    double LinearSpeed;

It’s a good thought. I do have it as a public variable though, so that’s not it.

Hello, AusPaco

You can try float instead of double and it should be editable.

Hope this helped! Cheers!

Yup, that worked. Thanks!

I got this problem too at I first try with the ACT RPG learning program. I move PostEditChangeProperty() and PostInitProperties() from public to protected, and keep the variables I want to edit in blueprint in public, then I run compile. Everything seems to be right now, and I can change the values of the variables same as the tutorial. But I don’t know the exact reason for this.