- Home /
This question was
closed Feb 11, 2016 at 11:57 AM by
meat5000 for the following reason:
Common question. No attempt made.
Change clone sprite when collides with player C#
Hello, im creating an endless runner game and my ground is made up by clones. How can i change the clone sprite when the player collides with it?
Comment
Hit google and do some research before posting common questions please.
Answer by irfan21 · Feb 11, 2016 at 05:45 PM
You can change sprite using spriterenderer....
public Sprite newSprite;
void OnCollisionEnter(Collision col) {
if(col.gameObject.tag=="clone")
col.gameObject.GetComponent<SpriteRenderer> ().sprite = newSprite;
}
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
How can I load and position my sprites in c#? 1 Answer
How can I set a sprite to a bunch of clones? 1 Answer
Inverting the cutoff property (UI bar) 0 Answers