About 'Damage Affordance'!



In this video (objectives)…

  1. Create an array to hold our damage sprites.
  2. Change our sprite renderer depending upon how many hits a block has taken.

After watching (learning outcomes)… Change the sprite displayed for a block based upon how many hits it has taken.

(Unique Video Reference: 31_BR_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!


Hey Rick,

Do you have a supplemental recommended reading list about game design in general?

When you used the word “affordance” like that it made me want to learn more about what else I don’t know.



Hi there,

I really like The Art Of Game Design: A Book Of Lenses by Jesse Schelle. Its a great book that will really train your brain on how to think like a designer.


Very cool, I’ll pick it up.

Thanks for the info, Rick!
Looks like a good read.

Thanks again,


Hi Rick!

I’ve been experimenting with creating different sizes of breakable blocks.

The damaged blocks sprites are 128x128. Some of my blocks are larger or smaller than 128x128. Whenever I damage a block, the damaged block sprite is always 128x128.

As a fix I’ve resized the damaged block sprites in gimp and added them to my sprites folder in my Block Breaker game. So I have multiple sprites that look identical, but are different sizes.

My question is, does Unity provide a more convenient way that allows a damaged block sprite retain the size of the block its assigned to? Or is the manual work around I’ve done the best way to keep the sprites consistent with one another?


Hi Vincent, have you tried changing the pixels per unit for your various sprites so that they look the same in game?


Ah yes! That is a much simpler way to get the sprites to be consistent with each other.



Hey. In this lesson, I conducted several experiments, and I had a question. I have a prefab block, and I want to change the sprite of just one block in the click event.
But when I click on the mouse button, all the blocks change.
Could you help me?

Example part of code

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Block : MonoBehaviour {

    [SerializeField] Sprite damageSprite;

	void Update () {
                   GetComponent<SpriteRenderer>().sprite = damageSprite;


If you want this to happen on only 1 block and you know beforehand which block it is, then you could add your script to just that one instance of the block and not the prefab.

If however you want the player to be able to click on any block and change the characteristics of it then you would need to use OnMouseDown rather than GetMouseButtonDown and add a collider to the block prefab. GetMouseButtonDown will see if you push your button anywhere, whereas OnMouseDown is assessing if the buttons was pushed while over the top of the collider.


Thank you so much. Your answer help to me.
OnMouseDown solved my problem


Awesome, good to hear!