i want to declare a value in C++,and then use this value in blueprint,just like:
class XXX_API AXXX : public ACharacter
UPROPERTY(EditAnywhere, Category = "Demo")
then some blueprint extends from AXXX,but each subclass’s Source is different,and i want to set Souce value,but i can’t not set compoent which i add in blueprint.
B inherit from AXXX,B is blueprint,and i add a springArm in B blueprint,i want to set this springArm to Source,but i can not edit it in B blueprint Editor,Source need set in B Scene,and i can not set B’s springArm to Source.
Thanks for silik1 reply,but i want to know how to set a instance to a property,for example,i make a character base class with a USceneComponent* in c++,then i make a bp form that class,and how i set this USceneComponent* for a camera i add on bp?
**Setting C++ Component Pointers in Blueprint Constructor Script**
This should get you what you want, which is the ability to link a C++ pointer of a component to a component created in the BP of the C++ base class.
I recommend setting the pointer in your BP constructor script.
BP Constructor Script (in Editor)
Then in BP constructor script for your C++ base class, Set the JoyfulCamera pointer to the BP Camera component.
You might want to use the actual camera component ptr instead in case you wish to access member variables of the camera in C++
Any Component Will Work
This code concept of only declaring the pointer in C++ will work for ANY component that you wish to create in BP instead.
I use this model frequently because setting all the default parameters for a component is a lot more fun to do in BP than in C++ constructor, and as long as you set the variable in your constructor script of your BP it is quite a secure method.