In the getting started documentation, Code a First-Person Adventure Game path I found some problems.
In Add a First-Person Camera, Mesh, and Animation section
- The positioning of skeletal meshes are wrong.
- Comparing to BP_FirstPersonCharacter Mesh transform is not set
- SetupAttachment to head socket in constructor does not work. To fix it, I needed to unparent/reparent my blueprint to the c++, it seems there is a refresh bug here. It Should be mentioned in the documentation (because it seems like an old known refresh problem about c++/blueprint).
Here the result :
- This need a if != nullptr to avoid a crash when anim has not been set in blueprint :
// Set the animations on the first person mesh. FirstPersonMeshComponent->SetAnimInstanceClass(FirstPersonDefaultAnim->GeneratedClass); -
This is wrong because it cast a shadow :
Because your third-person mesh is hidden when the game begins, you only need to set animations on the first-person mesh.
Also perhaps an explanation about how/when the constructor is called (for example when playing with property in editor) could be of interest.
In Create a Respawning Pickup Item section :
- Calling InitializePickup at each respawn will produce NewObject (is it not a leak?)
- ReferenceItem is never really used, what it’s for. It could be used to avoid newobject leak as a cache (as it’s seems to be implied in the doc).
- PickupDataTable should be tested with IsValid() to LoadSynchronous() if not, because of the softprtr
- ItemDataRow should be tested to be sure row has been found
- SetTimer must be called with -1 as last parameter, 0 will get an immediate respawn
reference documentation :
