TSubclassOf<> returns nullptr

Hi, a quick question regarding the use of TSubclassOf<>. I have created a WBP named WBP_SessionListItem, and assigned the class by picking the class type in the BP. However, in code, the ClassType kept returning Null as if i have never picked anything in BP. But, when switched to using FClassFinder<> in the constructor, everything worked, why is this the case?? Why can’t I use the BP to pick my classtype??


Screenshot 2022-04-18 223031

Hi Jia and welcome to the community.
This sometimes happens and there’s 2 things you can do here.

First, close down the Unreal Editor and delete the binaries folder. On launch, it will prompt for a recompile. This may solve the issue.

If it fails to work, then the second thing to try is to reparent the blueprint in question to a UUserWidget then back to the UMainMenuWidget - this requires a bit of reassigning of properties - sometimes modifying code causes this to happen and it can be really annoying.

Give these a try and let me know how you get on.