- Home /
Question by
TheIncognito · Sep 12, 2013 at 06:05 AM ·
gameobjectplayer
material.SetTexture reset
I'm working on a project (I've finished my "Hide and Seek" one) and am working on a fighting game like smash bros. i have gotten the character (For now a goku sprite) and have gotten it to look one way when moving, and the other, but when the key is released. they stay the way they are. if i use
if(Input.GetKeyUp(KeyCode.Key))
it makes a grey box covering my character.
My current script:
using UnityEngine;
using System.Collections;
public class GokuAnimate : MonoBehaviour {
public Texture gokuMove;
public Texture gokuMoveL;
public Texture gokuStand;
void Update () {
if(Input.GetKeyDown(KeyCode.D))
{
renderer.material.SetTexture("_MainTex", gokuMove);
}
if(Input.GetKeyDown(KeyCode.A))
{
renderer.material.SetTexture("_MainTex", gokuMoveL);
}
}
}
Comment
Solved the issue: Corrupted Image, had to remake it.