Download presentation
Presentation is loading. Please wait.
1
Unity Game Development
Saving & Loading using PlayerPrefs
2
Class overview Class 5 Revision Introduction to Mixamo.com
Setting up Player Setting up Enemy Setting up Collectibles Singleton - Coding Design Pattern Serialization of Data Saving Loading Advanced: Checkpoint System
3
Revision Third Person Camera Player Movement Camera Movement
Camera Rotation Camera LookAt Camera Zooming Importing Assets Animation BlendTree Advanced: Animation events Advanced: Contextual sound using Raycasting
4
Introduction to mixamo.com
Register Adobe account Preview & Select Characters Preview & Select Animations Download & Import .FBX to Unity
5
Setting up Player Create PlayerLogic (Movement, Jumping, …)
Create AnimatorController (Idle, Walk, Run, Jump) Setup BlendTree (Add parameters) Set Animation Parameters from Code
6
Setting up Enemy Create EnemyLogic (Movement, Distance checking, States…) Create AnimatorController Setup BlendTree (Add parameters) Set Animation Parameters from Code
7
Setting up Collectibles
Create CoinLogic (Rotation, OnTriggerEnter,…) Advanced: Update UI on collection
8
Singleton - Coding Design Pattern
Singleton = There can only be one of it’s type, can be accessed from anywhere. Examples of Singletons: GameManager, UIManager, AIManager, MusicManager, LocalisationManager, … “In software engineering, the singleton pattern is a software design pattern that restricts the instantiation of a class to one "single" instance. This is useful when exactly one object is needed to coordinate actions across the system. The term comes from the mathematical concept of a singleton.”
9
Serialization of Data Savable Datatypes: Int, Float, String
Vector3 cannot be saved Vector3 = 3 x Float (Pos X, Pos Y, Pos Z) Enums cannot be saved Enum = Int
10
Saving PlayerPrefs.SetFloat("PlayerPosX", transform.position.x);
PlayerPrefs.SetFloat("PlayerPosY", transform.position.y); PlayerPrefs.SetFloat("PlayerPosZ", transform.position.z); PlayerPrefs.Save();
11
Loading float playerPosX = PlayerPrefs.GetFloat("PlayerPosX");
float playerPosY = PlayerPrefs.GetFloat("PlayerPosY"); float playerPosZ = PlayerPrefs.GetFloat("PlayerPosZ"); transform.position = new Vector3(playerPosX, playerPosY, playerPosZ);
12
Checkpoint system OnTriggerEnter Save Data
OnDeath Load Data from Last Checkpoint
13
Q&A Do you have any questions related to the topics mentioned?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.