Any best practice GC.Collect for game?
You can only implement things like .Dispose(), you have virtually no control over it.
Unless that has changed since .NET 4.5…
Yes, Dispose implemented, and im on .net 4.5 and above
The best thing to do is to avoid hitting by Garbage Collection as much as possible by creating a re-usable objects and force garbage collection say at every next level or where the player expected a pause or intermission.
That’s good advice. Don’t collect at all would be ideal, but games don’t always allow you to get away with that, so collect only when there is time to do so is probably the best you can do.
My favorite comprehensive article about Garbage collector management is https://www.shawnhargreaves.com/blog/twin-paths-to-garbage-collector-nirvana.html from Shawn Hargreaves.
Dot not allocate during gameplay to avoid slowdowns AND/OR
Allocate as few objects as possible to minimize garbage collection duration.
As others have suggested, forcing a collect before a gameplay sequence has worked well for me when combined with the “Twin path to garbage collector nirvana”