Matenia 625 Posted June 25, 2018 Share Posted June 25, 2018 Hey @Droidz through my plugin, I want to add some states of my own (mostly for custom training etc). Unfortunately, when doing this OnEngineStart event, I always get: [E] 13:50:08 - Engine > Pulse(): System.InvalidOperationException: Collection was modified; enumeration operation may not execute. at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource) at System.Collections.Generic.List`1.Enumerator.MoveNextRare() at System.Collections.Generic.List`1.Enumerator.MoveNext() at robotManager.FiniteStateMachine.Engine.Pulse() which makes sense. Is there any way to add my own states, currently? I couldn't find any event that fires before EngineStart and I am sure I'm not modifying the collection DURING Pulse on another thread. Link to comment Share on other sites More sharing options...
Droidz 2733 Posted June 26, 2018 Share Posted June 26, 2018 Hello, you use AddState ? robotManager.Events.FiniteStateMachineEvents.OnStartEngine += engine => { engine.AddState(MyState); }; Link to comment Share on other sites More sharing options...
Matenia 625 Posted June 26, 2018 Author Share Posted June 26, 2018 Yeah, I only get the exception once and then it works. All good. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now