• Home  / 
  • Unity3D
  •  /  VR / VIVE Games – Day 6 – StackEm Quick [Includes Source]

VR / VIVE Games – Day 6 – StackEm Quick [Includes Source]

HTC VIVE Game Challenge

This week, I’ve decided to start a new VIVE challenge.  Each day, I’ll be creating a new Unity game developed specifically for the HTC VIVE.

I’ll spend a single day on each game (really about 4-6h of a day), creating the base gameplay and polishing up the experience a little.htc-vive-steam-vr-logo

After each game is complete, I’ll post the results here with a gameplay video and some thoughts on how it worked out.  I’ll also provide a download link for any current Vive owners to try it out and see how the experiences turn out.


Game 6 is ready now!

VIVE – StackEm Quick

This time, I wanted to mix it up a bit.  If you’ve seen the other games I’ve done this week, you may have noticed they’re pretty art heavy and take full advantage of the Asset Store.  While that’s a lot of fun, and can make games look great visually (great for a 4-6h prototype), I wanted to do something this time that used NO art from the store that you can DOWNLOAD and build yourself.

In StackEm Quick, the goal is to copy the randomized stack of colors as many times as you can in 60 seconds.  Each time you match the required pattern, you’ll score and a new pattern appears.  It’s intense when the timer gets low and you have to stay calm to keep your blocks from falling over.

Source Available

Again, the source for this project is available in the download.  Just use the normal download form below and you’ll get the game and the Unity project delivered to you immediately so you can play or tweak it all you like.



I’m very happy with how this one ended up.  At the beginning of the day, I had no idea what I was going to build.  Well… I had a few ideas, but none of those worked out.  This one started with me not really knowing how it would end up, and resulted in something that the family was fighting over not wanting to give up.  Picking things up and generally manipulating objects in the VIVE is a lot of fun and an interaction that should be focused on heavily.


This project actually has more code than any of the previous.  The main gamestate is controlled by the “GameStateManager” class.  In a larger project, this logic would need to be split out across a variety of classes/state objects, but ours is small so it’s all right there.  Interactions with other objects each reside in their own classes to keep things relatively clean.



This class is responsible for the core game loop.  It deals with the timer and tells all our other components what to do and when to do it.  There are 2 properties on this component, “Round Duration” is the length of each round in seconds.  ShapeLocation is the area to spawn our shape the player must copy (the white platform).

StackEm Quick - GameStateManager

Falling Object


Those 4 blocks on the floor are placed in the scene.  They’re cubes scaled to 0.5 on all axis with a “MoveableObject” script attached.  The “MoveableObject” script has an Enum field defining the color.  This is used by the “ShapeComparer” to make sure you’ve stacked in the right order.


StackEm Quick - Player Hand

The hands are used to pickup blocks.  Pitching - CollidersThey’re attached to the Controllers of the [CameraRig] and have a single property for “Pickup Radius“.  This controls how far away the sphere can be from the box to pick it up.  When the player pulls the trigger, the Hands call a PickUp() method on the nearest block within the “Pickup Radius“.  When the player releases the trigger, the box is released and drops using normal Unity physics.

StackEm Quick - Camera Rig




Invisible Walls

To avoid players dropping their cubes off the edges (or knocking them away by trying to release 1 inside another, I’ve added some invisible walls.  These are done with cubes where the renderer is turned off.  StackEm Quick - Invisible Walls SceneThere are 6, they block stuff from falling, that’s all.hich case we don’t need to do

StackEm Quick - Invisible Walls

Shape Factory & Shape Comparer

These classes exist to create a random shape and then to compare the shape the player has built against it.  They were initially planned to create a variety of different shapes (think T, L, etc), but it turned out that building straight piles was the most fun and easiest to explain.  Building other shapes would have required the ability to stick blocks together and take them apart (which you may notice some remnants of in the code).  So for now, the random shape generation is done by taking all the available shapes, picking a random order, then spawning them in that order.




The UI here has a ScoreBoard script that’s called by the GameStateManager when the ShapeComparer returns true.  It also has a timer that’s updated every frame by the “GameStateManager”.


Up Tomorrow: ????