[UE4]How to share character’s blueprint and animation blueprint !!
It is quite tedious task to create blueprint (hereinafter “BP”) and Animation Blueprint (hereinafter “ABP”) for every characters. You can probably do this by copying and pasting its information, but in case you encounter change any of the information in BP or ABP, you may do so in every BP and ABP.
In this section, you will learn how to duplicate and share BP and ABP in order to prevent the repeated task.
Let’s assume that we have a character with BP and ABP shown in figure1 below.
In this example, I have created the node handling idle animation and basic movement shown in figure2. FIn the real game design, you may need to create hundreds of nodes, and go through somewhat complicated designing.
Duplicating and sharing BP and ABP is quite simply – Simply reuse the existing the node.
- CASE 1- Creating new BP based on the existing BP.
You can simply select the existing BP, and open the menu “create Child Blueprint Class” by right clicking to create new BP. Once you have created the Child Blueprint class, you can now enter the name, and change the skeletal mesh by opening the BP editor (you can change the skeletal mesh at detail tab located in BP editor Component à Mesh menu. In addition, you can define the collision site; transform info, and other values at “Class Default” menu.
Now you will see “Construction Script” and “Event Graph” as shown in Figure3.
In figure3 marked in red rectangular box, “Animation Blueprint Generated Class” remains NONE under Details à Animation menu. You may create new ABP to apply the value there. (More detailed explanation will be provided below)
In figure4, “Event Tick” node of “construction script” is calling its parent. This means parent node handles the task for children note (Construction script in this case), therefore you can utilize the existing (conventional) node to take care. As shown in figure5 This is synonymous to the class inherit of the programming .
- CASE2 – Creating new ABP based on the existing ABP.
This sounds very similar to CASE1. Many people (if you understand CASE1) may select the existing ABP, and open the menu “create Child Blueprint Class” by right clicking to create new ABP. HOWEVER, this is not a valid method unfortunately. If you do this way, you are not able to change skeleton or skeletalmesh at all.
Figure6 is newly created ABP following the method covered in CASE1. As you can see skeleton and Mesh is set to the (identical to) original property value, and UE does not allow to change it. (If anyone know how to change this, please drop me a line) Unfortunately, it did not work when I try, thus I have come up with alternative method which will be described below:
Create new Animation Blueprint as shown in figure7.
Once you configure the skeleton for ABP as shown in figure8., new ABP is created and some tasks need to be done.
Select the ABP to be reused in “Parent Class” located at “Blueprint Options” à “Class Options” in the Class Settings. This makes the ABP become Parent.
Select “Class Defaults” to configure the necessary values shown in figure9.
Then, add call to parent function as shown in Figure 10 and 11.
Lastly, return to character BP after configuring and compiling. Go to “Components” à “Mesh detail” à “Animation” à “Anim Blue Print Generated Class” to setthe “Anime Blueprint Generated Class” as for new ABP, then compile. For your information, this leads “Anim graph” of ABP remain blank. (But this did not cause any problem so far)
Once you have done all the procedure above, You will see new character added and function properly.