and finally inside of my weapon constructor, I use Item mesh as well. and access it fine but jut like the two previous, it comes back Null. how do I fix this error?
Does AWeapon inherit from AItem? If so does it call it’s parents constructor? You may be missing the super init hence the parent’s createdefaultsubobject might not being called leaving it’s parameters as nullptr.
Ahh yes you need to change both AItem and AWeapons constructor for it to work
Both need to take in const FObjectInitializer& ObjectInitializer otherwise calling super (the parent) won’t work as they have different constructor parameters.
i understand what happened but not how to fix it. my item mesh is returning null because it is empty, so all the children are also returning null for that reason, but I can’t add a mesh into it and I see no error in the code that could have caused this.
Try putting a breakpoint at the createdefaultsubobject for the aitem and aweapon and see if aitems constructor is being called during aweapons init. I’ll do a test of my own once I’m at my pc.
If the error happened during the project compile then just add a nullptr test before accessing itemmesh
So if(itemmesh!=nullptr){
}