If you have never used the AddManualSprite method, then you have most likely worked with "automatically updated" Sprites. In fact, most objects which are added to managers are automatically updated, so the concept of whether something is updated or not may not have even been a consideration. While automatic updating or "management" is very convenient, it can also be inefficient - especially if situations with a large number of objects which do not need every-frame updates. One common example of unnecessary updating is when Sprites are used as "environment" such as tiles in a tile map. In these situations the Sprites are initially set, but after the initial positioning the Sprites will never move. Therefore, every-frame updates are unnecessary. In these situations manual Sprites can be used to reduce the overhead of each instance. The AddManualSprite method creates a Sprite which will not have its update called automatically. While this improves performance, any update(s) must be followed by a call to SpriteManager.ManualUpdate(spriteToUpdate). Without this call the changes will not be visible.
The following code example shows a performance difference between manually and automatically updated Sprites. The performance numbers are recorded on a laptop which does not have a powerful graphics card. Therefore, computers with more powerful graphics cards may see more drastic changes in numbers between the two types of Sprites
Add the following using statement:
Add the following at class scope:
Do one of the following two:
Add the following to Initialize after initializing FlatRedBall to create a group of automatically updated Sprites:
OR...
Add the following to Initialize after initializing FlatRedBall to create a group of manually updated Sprites:
Add the following to Update to display frame time:
FlatRedBall.SpriteManager.ConvertToManuallyUpdated - Can be used to convert an already-created object to be manually updated.
Manually updated objects tutorial - Discusses details of manually updated objects.
Automatically Updated: Manually Updated: