I’m creating a blueprint node that takes in a TArray of URoom. The method to get all the rooms that will be passed to the node returns a TArray<TWeakObjectPtr>. My class that maintains all the rooms has a collection of TWeakObjectPtr, so they’re always kept as a TWeakObjectPtr. The problem is the blueprint node cannot take in a TArray.
Do I need to run through the TArray and convert each instance to a URoom*? Is there an easy way to do this? Or have I set this up incorrectly?
I don´t think you can expose to bps a variable of type TArray<TWeak…> but you can expose a TArray<Ubject*> and in fact that is the normal way (to my knowledge).
As long as the variable is defined as a UProperty it will get garbage collected properly.
Thank you for that. You got me to reread the docs, and it turns out each Room is part of a TMAP. Poitners inside a TMAP are managed by Unreal’s GC, so I don’t need to use TWeakObjectPtr… To top it off, the TMAP is inside a UObject that’s a UPROPERTY of the GameMode. So I’ve been overcomplicating my objects.