Skip to content

Instantly share code, notes, and snippets.

Created November 2, 2018 20:54
What would you like to do?
Unity: Combine two textures in one, basic in TextureA copy TextureB
Texture2D CombineTexutes(Texture2D _textureA, Texture2D _textureB)
//Create new textures
Texture2D textureResult = new Texture2D(_textureA.width, _textureA.height);
//create clone form texture
//Now copy texture B in texutre A
for (int x = 0; x<_textureB.width; x++)
for (int y = 0; y<_textureB.height; y++)
Color c = _textureB.GetPixel(x, y);
if (c.a > 0.0f) //Is not transparent
//Copy pixel colot in TexturaA
textureResult.SetPixel(x, y, c);
//Apply colors
return textureResult;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment