- Home /
Cost of changing texture
Hello,
I'm working on a top down PC game. Is it safe to assume that the cost of changing a material's texture is miniscule? Trying to figure out the arrangement of sprite sheets, and it would be simpler to do it this way.
Thanks for reading
It depends on the texture. You could ins$$anonymous$$d always load both beforehand and on switch hide one and show another
The cost of switching textures already loaded should be small. But if you have a lot of game objects with different textures but the same material otherwise, you can reduce your drawcalls by using a texture atlas and switching the UVs ins$$anonymous$$d.
The biggest cost will be loading the texture into graphics memory. There will be a noticeable hang if you are loading a lot of textures simultaneously- but the trick is that if you do this at the beginning of a level and put a 'LOADING' card on top, nobody will care.
Sorry for the slow response, was out of bounds for a while there. Thanks for the suggestions. I've already assigned the texture to a Texture2D field, so it won't need to be loaded on the fly. The texture changes only happens with one gameobject, whenever the player character changes weapon, so it might happen a few times a $$anonymous$$ute. Nothing to worry about I guess.