Class Hours: 10:05 – 2:40
Mr. Bohmann | wbohmann@ewsd.org
10:05 Today’s Notes & Attendance
- Last Day of April – 30ish days left for school!
10:10 SkySweeper – Unity Design/Programming

Instantiate is a just a fancy way of saying in C# that we are going to spawn a game object or objects at runtime. In our game, we’ll use instantiate to spawn some particle VFX when our ship and the objects we vaporize are destroyed.
We’ve already created the Enemy Script and placed it on any enemy or trash items. We also need some kind of script for our ship in case we crash into the environment or something else threatening. This script will be called CollisionHandler and we’ll put it on our PlayerShip.
using UnityEngine;
public class CollisionHandler : MonoBehaviour
{
[SerializeField] private GameObject destroyVFX;
private void OnTriggerEnter(Collider other)
{
Instantiate(destroyVFX, transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
- Particle Collision for when we get some trash and Instantiate ParticleVFX
- Trash Hit Points
When we vaporize trash, each item can be worth different hit point values. So maybe it takes one hit for some items while others require multiple hits before the item is destroyed.
using UnityEngine;
public class Enemy : MonoBehaviour
{
[SerializeField] private GameObject destroyVFX;
[SerializeField] private int hitPoints = 2;
private void OnParticleCollision(GameObject other)
{
ProcessHit();
}
private void ProcessHit()
{
hitPoints = hitPoints - 1;
if (hitPoints <= 0)
{
Instantiate(destroyVFX, transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
}
10:50 Morning Break (10 minutes)

11:00 SkySweeper – Unity Design/Programming

Let’s set up some scoring so that when we collect trash, we also get a score. Seeing a score gives the player something to play for and something to brag about. Without a score, it feels less like a game.
We’ll create an empty Game Object Called Scoreboard and put our logic on that game item. We’ll make the method Public, so the enemy script can communicate with the Scoarboard script. Additionally we’ll add to our Canvas a scoreboard text. We can also assign values to our trash items.
Scoreboard script:
using UnityEngine;
using TMPro;
public class Scoreboard : MonoBehaviour
{
int score = 0;
[SerializeField] TMP_Text scoreText;
public void IncreaseScore(int amount)
{
score = score + amount;
Debug.Log(score);
scoreText.text = score.ToString();
}
}
Updated Enemy Script:
using UnityEngine;
public class Enemy : MonoBehaviour
{
[SerializeField] private GameObject destroyVFX;
[SerializeField] private int hitPoints = 2;
[SerializeField] int scoreValue = 10;
Scoreboard scoreBoard;
private void Start()
{
scoreBoard = FindAnyObjectByType<Scoreboard>();
}
private void OnParticleCollision(GameObject other)
{
ProcessHit();
}
private void ProcessHit()
{
hitPoints = hitPoints - 1;
if (hitPoints <= 0)
{
scoreBoard.IncreaseScore(scoreValue);
Instantiate(destroyVFX, transform.position, Quaternion.identity);
Destroy(gameObject);
}
}
}
Asset Jam with whatever time is left
11:55 Lunch
12:25 English with Mx. Yopp

1:10 Afternoon Break

1:25 Speed Design

1:45 Independent Production & Guided Support
- Breakout Game – Full Game Due on Friday, May 8th
- SkySweeper – Environmental Build Out
2:10 Dailies

2:15 Independent Reading

2:40 Dismissal

