private Material GetMaterial(string atlasPath) { if (anim.useSeparateMaterial) { if (materials.ContainsKey(atlasPath)) { Material m = materials[atlasPath]; if (m.shader != GetShader()) { m.shader = GetShader(); } return(m); } else { Material m = new Material(TPUtils.GetAtlasMaterial(atlasPath)); m.shader = GetShader(); materials.Add(atlasPath, m); return(m); } } else { return(TPUtils.GetAtlasMaterial(atlasPath)); } }
public override void ShowFrame(int index) { if (frames.Count == 0) { GetComponent <Renderer>().material = null; return; } TPFameInfo frame = frames[index]; meshTexture.atlas = frame.atlasPath; meshTexture.texture = frame.textureName; GetComponent <Renderer>().material = TPUtils.GetAtlasMaterial(frame.atlasPath); meshTexture.applayUV(); }