Building a Puzzle | Pt 3 - Build + Polish
In the final part of this series, we are going to discuss putting our puzzle together in the engine, Unity. We’ve already covered the creation of the assets in the first instalment and the code behind the puzzle in the second post so please check them out if you haven’t already. Jumping into Unity, we’re going to finish setting up this puzzle.
The puzzle is triggered when the player speaks to a certain character at night after solving several environmental puzzles. As it’s the first puzzle to take place outside the game world, we had to build some new systems for it.
We didn’t want to load a separate level for the puzzle, as this would result in a lot of hassle when resuming the game. Instead, we built it onto a canvas, which could be activated when needed. Canvases in Unity act like layers which sit on top of the game view; we use several for things like the HUD and the journal menu. We built the puzzle in 4 layers; the background image, the complete images, the lines, and finally the stars. The stars needed to be the topmost layer, so that the player could click on them easily
Once the images had been imported and set on the canvas, I started placing stars. After making a single template, I duplicated it repeatedly, moving each copy to a corner on the deer image, and marking the appropriate stars as part of the hidden image. Once this was done, I disabled the deer image, and started placing lines to link the stars up. With them in place, I then had to select each one and link the scripts on them to the appropriate stars. This quickly became incredibly tedious.
After testing the puzzle to make sure everything was set up correctly and there were no obvious bugs, I added a little polish. For the two images, I created a pair of animations so that the deer would appear and fade out at the start, and the crow would fade in once the puzzle was solved. I also added animations to the stars, similar to the ones on our menus, that made their size oscillate when the mouse was hovered over them.
After adding a simple UI feature, here is the final product:
And there we have it, creating a puzzle beginning to end in Unity.
Be sure to keep an eye out for this puzzle in our upcoming build release!
Until then, Team Eden Falls