I am creating a game with Unreal Engine 5.1.
In this game I want to have items that I can pick up.
To do this, I created a parent class named “PickUpItem”, which represents all possible items.
Then a class named “Weapons” that inherits from “PickUpItem” for all weapons.
Finally, a class named “Swords” that inherits from “Weapons” for all swords.
In each class I have specific variable and functions.
Now I want to add some swords to my world.
To do that I did the same than before each blueprint inherits from his c++ class.
When I do that all my variables and functions are visible but there is a problem.
If I modify a parent blueprint for example if I want to had a box collider to all my Weapons. Then if I add the box collider to the “Weapon” blueprint it doesn’t affect all the children.
I found a solution to that by making only the “PickUpItem_BP” blueprint inherits from the c++ class “PickUpItems”. With this way, “Weapons_BP” inherits from “PickUPItem_BP”, “Swords_BP” inherits from “Weapons_BP”.
With this technique when I add a box collider to “PickUpItem_BP” then it’s added to the childen.
The problem is that all the variable and function of the children are not visible on the children blueprint.
So I want to know how I am suppose to create my blueprint to be able to have all my variable and function but also the possibility to add components from the parents.
I understand your problem and why it is happening. I will try to explain what is going wrong with an example. Say you have C++ and BP classes as follows.
BP_Sword (Blueprint class) is a child of ASword (CPP class) which is in turn a child of AWeapon (CPP class).
Now, when you make changes to BP_Weapon such as adding Actor Components, those changes only apply to the BP_Weapon class and not to the AWeapon class.
That means, any changes to BP_Weapon will not apply to its parent (AWeapon) or to other children of its parent (ASword and thereby neither to BP_Sword).
To solve this problem, you will have to add any Actor Components you also want the child classes to have, to the parent C++ class.
When I update my c++ code with for example a new Component.
Or when I modify the parameters of a component it doesn’t affect the blueprint.
I tried to compile again but the only solution update the blueprint is to recreate it.
But in my case I need the changes to affect all the blueprint without creating them again
I use a source build of the Engine and start up my project with debugging from the IDE. Every time I change something in C++, I try to use the Hot Compile feature in the engine and for small changes it works, but for larger changes, I just restart the Engine instance again using the IDE. This means, any changes to the source are also compiled by the IDE.
The only secure way of making sure everything works though is building the changes from the IDE and restarting the Engine. No other way around it. Recreating the blueprint isn’t necessary after doing this.