Your game expects a certain asset to be loaded, but it isn't found. How should the situation be handled? For example:

Texture* grassTexture = LoadTexture("Grass.png"); // returns NULL; texture not found
Mesh* car             = LoadMesh("Car.obj");      // returns NULL; 3D mesh not found

It might have been accidentally deleted by the user, corrupted or misspelled while in development.

Some potential responses:

  • Assertions (ideally only during development)
  • Exit the game gracefully
  • Throw an exception and try to handle it.

Which way is best?

  • \$\begingroup\$ One way to do it is verify if the game data is still intact. If not automatically redownload the missing data. error > ask user to verify data > download. You obviously need to create a small tool for this. \$\endgroup\$
    – Sidar
    Nov 11, 2013 at 11:53
  • \$\begingroup\$ @Sidar I like what you said more than the most voted answer maybe you can explain better what are you trying to say \$\endgroup\$
    – concept3d
    Nov 11, 2013 at 18:47
  • \$\begingroup\$ Ugliness of errors is that sometimes it just breaks the game and people can't play it/start it up. In Steam for example if your game is not working properly you can verify the game data. When something seems corrupt/missing/changed Steam will automatically re-download those files. I don't know exactly how they do it. But they obviously check it against some data. Perhaps hash codes? I really don't know. But you should always have a standard replacement asset ( simply texture that says "error" on it or something) \$\endgroup\$
    – Sidar
    Nov 11, 2013 at 19:05
  • \$\begingroup\$ @Sidar why not format it nicely in an answer ? \$\endgroup\$
    – concept3d
    Nov 11, 2013 at 19:14
  • \$\begingroup\$ Because I don't know exactly how it works and don't want to be misinforming about it. So I couldn't give you a proper answer. \$\endgroup\$
    – Sidar
    Nov 11, 2013 at 19:30

2 Answers 2


Lots of games have a generic "error material" and "error mesh" that is really obvious to see. Pair this with a warning in the logs, of course.

  • \$\begingroup\$ Completely agree with this post. You might want to do different things in a release / distributed build however. \$\endgroup\$
    – Jonkel
    Nov 11, 2013 at 9:26
  • \$\begingroup\$ For release builds one could think of an approch to validate the available files using hashing to download missing or invalid files. However during development it is definitely the best approch to display a black and magenta checkerboard texture to catch your attention. For models one could use a huge ERROR model which should be obvious. \$\endgroup\$ Nov 11, 2013 at 12:05
  • \$\begingroup\$ This makes sense for Textures. not so much for 3D Models. What if most 3D models were missing? The game will look funny, while it should be playable in the first place. What if you calculate your spatial data structure base on geometric properties of the 3D Models what should happen. I am with this only in simple circumstances like missing texture. But I think data completeness checking is just better approach for commercial games. \$\endgroup\$
    – concept3d
    Nov 12, 2013 at 5:09
  • 1
    \$\begingroup\$ @concept3d - I know at least the Source engine has a big, obvious error mesh (I've seen it occasionally in the Dota 2 test client, back when they were adding heroes). I agree that if big swaths of level data are missing, it's probably best just to error out, especially in a release build, but for debugging purposes having a big question mark dancing around isn't too bad. \$\endgroup\$ Nov 12, 2013 at 23:04

If you have different resolution assets of the same texture, you could try to salvage the situation by using a different resolution.

Texture* grassTexture;
try {
    grassTexture = LoadTexture("Grass.png");
} catch (WhateverExcaption e) {
    grassTexture = LoadTexture("Grass_512.png");

If even that fails, it might be time to bail.

  • 2
    \$\begingroup\$ You can add a toggle to the catch so in Dev you always show the missing mesh/tex but when Published it would try to recover first and maybe have a less obvious missing texture. \$\endgroup\$
    – DampeS8N
    Nov 11, 2013 at 22:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .