Contents

Intro


Alongside the narrative, our second-most priority is the radio functions. As we had originally planned, we want all of the buttons, switches and dials to move independently and correlate to a code that the player will find in the game. With the correct input, the radio will turn on. This mechanic has been inspired by ‘Untold Stories’, and we felt it was best to work as a way to access the story. Here’s where we are with that!

Making Changes


Dials in the Unity Project.

Dials in the Unity Project.

When beginning this, I realised my first mistake. All my buttons were a part of the radio sprite, meaning they could not move independently. On top of this, the radio sprite was a part of the background, which makes it a static image on the screen. I had to revisit my Procreate file and make a lot of changes.

In the project, I remade the sprite to be a separate image entirely from the scene, and all the individual aspects on it as different layers. This gave me the idea that I would need to do this for all the other scenes too, and save a lot of hassle.

Slide_1 (1).png

Slide_1.png

I also had to add numbers and buttons to the dials so that the player could easily pick up which ones to click from the code.

Since I also wanted there to be a clear difference when each button is pressed, I duplicated the sprites so that they either change colour or shape when clicked. I also made sure there was a variation in the numbers of the digital screen, as the aim is to have a different code for each number. This adds more to the memory game than just the same code over and over again.

All the button sprites.

All the button sprites.

In Photoshop, I took each sprite and made an individual PNG image out of them all, which I then used the Sprite editor in Unity to finalise.

The Code


The next step was making a code that could be applied to all the buttons to change with a click.

using UnityEngine;
using UnityEngine.UI;

public class SwitchButtonController : MonoBehaviour
{
public Sprite switchUpSprite;
public Sprite switchDownSprite;
public Image image; 

public void OnButtonClick()
{
    if (image != null)
    {
        if (image.sprite == switchDownSprite)
        {
            image.sprite = switchUpSprite;
        }
        else
        {
            image.sprite = switchDownSprite;
        }
    }
    else
    {
        Debug.LogError("Image reference is null. Make sure to assign the Image component in the Unity Editor.");
    }
}
}