hi mastahg, I seem to have encountered a mysterious bug, i use a System.Timers.Timer instance and subscribed its elapsed event to repeatedly trigger some functions outside the main behaviour tree, like this
It functions well, but I found that calling the elapsed function frequently has a certain chance of causing the game to close directly, without any error or exception in RB's log or a crash dialogbox from the game. A 100ms Timer may cause the game close randomly in a few hours, and a 1ms Timer will close the game in less than a minute.
I'm not sure what goes wrong, should I use some other method to refresh Managers for plugins?
Code:
System.Timers.Timer t = new System.Timers.Timer(100);
t.Elapsed += (sender, e) =>
{
RaptureAtkUnitManager.Update();
GameObjectManager.Update();
DirectorManager.Update();
if (GameObjectManager.GameObjects.Any(i=>i.Type == GameObjectType.Pc && !i.IsVisible) && !NowLoading.IsVisible)
{
//...
}
};
t.Start();
I'm not sure what goes wrong, should I use some other method to refresh Managers for plugins?