SubsystemBrowserPlugin
SubsystemBrowserPlugin copied to clipboard
Editor freezes when some subsystems are selected
When selecting my subsystem, the editor would freeze for a long period of time. This video was cut short, because it seemed the only way to resume working is to close and restart the editor. Same thing happened when I selected the Actor partition subsystem in the tree view. https://user-images.githubusercontent.com/23241818/182373106-16235ce1-1ae0-4168-833d-3876c6da9772.mp4
The subsystem consists of multiple arrays of components, actors, FGuid's and a TMap<FGuid, CustomStruct>
//properties
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SLDynamics")
TArray<ASLDDevice*> Devices;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SLDynamics")
TArray<USLDPortComponent*> OriginPortComponents;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SLDynamics")
TArray<USLDPortComponent*> PortComponents;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SLDynamics")
TArray<FGuid> PortIDs;
//TODO: Swap to sorted map, since it should be faster for smaller data sets
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SLDynamics")
TMap<FGuid, FPortData> PortMap;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SLDynamics")
TArray<USLDNetwork*> Networks;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "SLDynamics")
TArray<FSLDConnection> Connections;
and the struct inside the map is just this
USTRUCT(BlueprintType)
struct FPortData
{
GENERATED_BODY()
FPortData() { }
FPortData(USLDPortComponent* PortComponent)
{
component = PortComponent;
}
FORCEINLINE bool operator==(const FPortData &Other) const
{
return (component == Other.component) && (connections == Other.connections);
}
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SLDynamics")
USLDPortComponent* component;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "SLDynamics")
TArray<FGuid> connections;
};
Hi.
How many elements in arrays on average?
Can you attach debugger and hit "Break Execution" during freeze and provide call stack? Or at least check where it is sitting at.
It is also possible that there is simply too much data to show that editor breaks.
Editable pointers to actor components could be a big issue as well. But all of these are DetailsView issues.
I've had this issue with a few of my subsystems. It happens when I have arrays or dictionaries with data in them. Sometimes even with a small list (fewer than 10 items). It will eventually unfreeze. If the list is empty, then it will not freeze. If the array is filled while I already have the subsystem selected, it will not freeze.
I was able to reproduce the same issue on my end using an array of UUserWidgets and provided some insights when the hitch happens adding 2 elements to an array. When the array size changes, it has to save the expanded values. This has a chance to infinitely freeze due to constantly updating arrays.
What makes no sense is why.. the subsystem browser is taking so much longer to do the save expanded categories vs the actor details panel. It's very odd and would require a bit more time to dig deeper into what is different between a normal details panel and the subsystem browser's since they both use the same SDetailsViewBase widget.
Side note, for now you can avoid this issue by using the hide categories option.
UCLASS(BlueprintType, Blueprintable, meta = (DebugTreeLeaf), HideCategories=("Data","Delegates"))
And then on the UPROPERTY
UPROPERTY(VisibleAnywhere, Category="Data")
Tis a shame because it kind of defeats part of the reason why you'd want to look at the subsystem's properties.