Код: Выделить всё
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
public class Sprites
{
public string gameObject;
public SpriteRenderer spriteRenderer;
public Sprite SpriteRight;
public Sprite SpriteLeft;
void ChangeSprite()
{
if (Input.GetKeyDown(KeyCode.D))
{
gameObject.GetComponent().sprite = SpriteRight;
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/787 ... ss-a-and-d
Мобильная версия