Have an idea to set the texture to 3D material slowly. It would be like some animation, that change previous texture to new sloowly from bottom to top.
I need it to my game... Can't find the solution...
Can you help me with this problem?

  • \$\begingroup\$ use docs.unity3d.com/ScriptReference/Texture2D.SetPixels.html and go as slow or fast as you want. Be aware, this will change the entire texture of that file. So be sure to have a file that can be changed for that certain texture. \$\endgroup\$ Apr 26, 2017 at 10:30
  • \$\begingroup\$ I need to make it realtime in the 3D game.. \$\endgroup\$ Apr 26, 2017 at 10:36
  • 2
    \$\begingroup\$ Textures aren't 3D, they're fundamentally 2D. And "realtime" doesn't mean anything either (no seriously, what does this mean in this context?). So the suggestion John gave you absolutely works. \$\endgroup\$ Apr 26, 2017 at 12:37
  • \$\begingroup\$ @Draco18s Well, except for volume textures. ;) \$\endgroup\$
    – DMGregory
    Apr 26, 2017 at 16:44
  • \$\begingroup\$ @DMGregory Touche. They don't come up much, though. \$\endgroup\$ Apr 26, 2017 at 16:46

1 Answer 1


Create a new transition material that would use 2 textures and some 'transition amount' float in a [0-1] range. Use your custom shader to do the transition in a way you want.

Then, when you want to start animation replace initial material with your new one and start animating your 'amount' parameter. When you end the animation then set the basic material back, but with 2nd texture.

This way you'll avoid costly modifications of texture pixels and move all the work to GPU shaders.

  • \$\begingroup\$ Writing a custom shader to do this--assuming your base material is simple and can be easily replicated--is fairly easy and straight forward. It's very close to what the first shader I ever wrote was. \$\endgroup\$ Apr 26, 2017 at 13:38
  • \$\begingroup\$ Yes yes yes - this is infinitely a better use of processing power than using Texture2D.SetPixel. It might take a little more effort up front, but it'll pay off in the long run. \$\endgroup\$ Apr 26, 2017 at 18:35

You must log in to answer this question.

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