Hello,
I have created a UGameInstanceSubsystem class.
I wanted to implement a Tick function so I included inheritance from “FTickableGameObject”.
When I debug my code, there are 2 instances of my Subsystem each running their own Tick.
Only one of the instances are initialized with the Initialize(FSubsystemCollectionBase& Collection) function, and the other one is just running Tick and nothing else.
Have you had a look at UTickableWorldSubsystem (WorldSubsystem.h)? Even if it doesn’t suit your purposes, perhaps studying its implementation can provide some clues to the problem with your code.
How exactly did you have it setup with FTickableGameObject? That should work just fine.
The two instances that you’re seeing is definitely expected. The “Default__” instance is the Class Default Object that all classes have. It stores the defaults and it used when constructing new instances of the class.
It shouldn’t be ticking though. It’s possible that you were doing something in your constructor you shouldn’t have been doing. I’m using the FTickableGameObject from one of my subsystems and it seems to work just fine. But I’ll have to double check if there’s something else about how I have it setup.
That’s interesting, the same thing is happening for mine. It just doesn’t end up mattering in my case because the Default version will always return false from IsTickable.
You could check if it’s the CDO with HasAllFlags( RF_ClassDefaultObject ) and return false from IsTickable.
The other option would be a flag that’s only set by the non-CDO. That appears to be the route that UWaterSubsystem does in the water plugin.