游戏开发中需要粒子系统中的textureSheetAnimation下的Sprite模式需要换皮肤:代码如下
ParticleSystem particleSystem = this.GetComponent<ParticleSystem>(); if (particleSystem) { if (index >= 0 && index < spriteGroups.Count) { int spriteCount = particleSystem.textureSheetAnimation.spriteCount; for (int i = 0; i < spriteCount; i++) { particleSystem.textureSheetAnimation.RemoveSprite(i); } var _spriteGroups = spriteGroups[index]; for (int i = 0; i < _spriteGroups.sprites.Count; i++) { particleSystem.textureSheetAnimation.AddSprite(_spriteGroups.sprites[i]); } } }
请赞赏
朋友,创作不易;为犒赏小编的辛勤劳动,请她喝杯咖啡吧!
给她赞赏,您将财运亨通