Originally named “SimpleShooter - The Assets of Mesh for BP_ShooterCharacter have disappeared”
I was following the course Unreal Engine C++ Developer: Learn C++ and Make Video Games when near the end of lesson 191 “Create and Setup an AI controller”, in the BP_ShooterCharacter file’s Mesh Component, the assets showed “none” and i could not edit the Mesh properties. However, the rest of my files seemed to be not affected.
I found out about this from pressing “play” in Unreal, followed by a crash with this in the crash report:
UE4Editor_SimpleShooter_9199!AShooterCharacter::BeginPlay() [D:\Coding Projects\Unreal games\SimpleShooter\Source\SimpleShooter\ShooterCharacter.cpp:24]
In ShooterCharacter.cpp Line 24:
Gun->AttachToComponent(GetMesh(), FAttachmentTransformRules::KeepRelativeTransform, TEXT("WeaponSocket"));
This is where I found out something was wrong with the mesh. This code tried to get the WeaponSocket from the Mesh. However, there was no mesh in BP_ShooterCharacter so the code returned a nullptr and crashed Unreal.
BP_ShooterCharacter affected - cannot edit details:
BP_Rifle not affected:
the Wraith Mesh that should have been used in the BP_ShooterCharacter file is not affected:
Can someone help me find out the problem?
Right before I noticed this problem, I was changing the AI Controller Class from AIController to BP_ShooterAIController
==============================================================================
Update 2021-03-15:
I did what the above says and when I press play BP_ShooterCharacter remains unchanged. Good!
However, the game still crashed.
Then I changed the Gun Class parameter in BP_ShooterCharacter from “none” to “BP_Rifle” and everything is fixed now:
PROBLEM SOLVED
==============================================================================
stupid null pointers
Update 2021-03-19:
The mesh assets disappeared again from BP_ShooterCharacter
This time, I was making a child blueprint class of this file after just changing its mesh.
I solved the problem by remaking BP_ShooterCharacter, the same solution as before, but I think I need to find out why this problem happens.