天天看点

Unity 2D Toolkit中动态改变Animated Sprite的Shader

修改tk2dsprite.cs

In tk2dSprite.cs - do something like this

static bool ignoreMaterialChange = false;
protected override void UpdateMaterial()
{
   if (ignoreMaterialChange)
   {
      if (renderer.sharedMaterial == null)
         renderer.material = collection.spriteDefinitions[spriteId].material;
   }
   else
   {
      if (renderer.sharedMaterial != collection.spriteDefinitions[spriteId].material)
         renderer.material = collection.spriteDefinitions[spriteId].material;
   }
}
           

缺点: 当Collection是Multi-Altas时会出现问题

原帖地址: http://unikronsoftware.com/2dtoolkit/forum/index.php?topic=356.0

上一篇: keras入门一