Sunday, 4 October 2020

NEXT-GEN Nescot Year 4 HND - Basic: Button Scene Swapping (Unity)

For this short project, we were tasked with creating a game in the Unity Engine with a button that would swap between two separate scenes.


Firstly, I created the two scenes with similar names to show what scenes will swap between each other.


The first scene was created with an urban background while the second scene was created with a rural background in order to distinguish the two scenes from each other.


Once the scenes were created, I made a scene loader script that would allow me to change the value (name) of the script I wanted to swap into. This was done by creating a public string value which could be altered in the attributes menu of the object it is attached to.


Once this was done, I added the two scenes to the "Build Settings" by dragging and dropping them into the window. This is to allow the two scenes to swap between each other without causing errors.


After this, I created a button in both the first and second scene. This allowed me to add the SceneLoader script to the button and set the scene script value (the scene it will swap to) to the opposite scene of the currently loaded scene. And I set the button to active this effect once pressed.


Overall, I think this short project went well, the buttons worked effectively and the scenes changed easily. If I could improve this project, I would try to create a character with obstacles to play around with, to make the project more interesting.

No comments:

Post a Comment

NEXT-GEN Nescot Year 4 HND - Going Indie (Final game, itch.io Link)

For the final part of my Game Development project (Topdown Shooter), I was required to upload my finished game to Itch.io, allowing my game ...