Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class SwitchSprite : MonoBehaviour {
- public Sprite[] baseSprites;
- public Sprite[] replaceSprites;
- void LateUpdate () {
- for (var i = 0; i < baseSprites.Length; i++) {
- if (gameObject.GetComponent<SpriteRenderer>().sprite == baseSprites[i]) {
- gameObject.GetComponent<SpriteRenderer>().sprite = replaceSprites[i];
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement