THIS return null value (THIS should be a actorcomponent)

I was programming a delegate function for my inventory component when it suddenly decided to not work anymore. It used to work yesterday, but nothing today.

After exploring, i found out it would crash upon assigning a delegate signature to a public delegate. Something that you do all the time when messing with delegates. Ref: Ben UI Delegate example. After opening up the debugger, i found something EXTREMELY strange. The code that would work would have This, Delegate, and Token be proper values. Delegate and Token are empty, and thats to be expected. But the broken component doesnt have a This. It is null when viewed inside the debugger.

The fixed debugger looks like this. The token is a JSON token for API calls, and the delegate has yet to be bound. This references the component itself. It calls the Vehicle api:

This is the broken debugger. Everything is exactly the same because it calls the Inventory API. I expanded the Delegate called onSuccessFetch because i was convinced it was the problem since it crashes upon being assigned. Upon looking close, This is NULL.

Looking further in the debugger, it shows the Owner not even owning an InventoryComponent. Which is wrong because the function wouldnt be calling if it didnt exist. Its also added to the character within the constructor.

Going inside my HTTP comp, i can find the owner. Its the pawn/player. I can then view all the components the player has, and i see that inventory is null along with PEIC.

How th does a non-existent component exist enough to run a function to crash the engine? Why do I get the luck with Schrodinger’s component?

Yea. I was working on this problem all day. I cleaned the Intermediate folder. I clean the project. I rebuilt the engine and the solution.

I was at a complete lost. Then it occurred to me that UE like to be a janky ■■■ mess and that I should just reparent the actor to something else, and then parent it back. And it worked.

/ >:( /

1 Like