Save and Load a Player Loadout | Gun Series Part 14 | Unity Tutorial

Опубликовано: 26 Март 2026
на канале: LlamAcademy
3,857
128

Learn how you can save and load a player's loadout when using ScriptableObjects for your gun configurations. You'll also see how you can adapt what we've done so far for a loadout screen to integrate it into a "main menu". All with UI Toolkit!

👨‍💻 As always, all code from this video is available on GitHub: https://github.com/llamacademy/script...

🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: https://www.jetbrains.com/store/?sect...

📚 Resources:
⚫ Gun Series Playlist:    • Scriptable-Object Based Gun System From Sc...  
⚫ Save and Load Data using JSON data format:    • Data Persistence - Save & load your game s...  

🧡 Believe in LlamAcademy's mission and have received value from the videos? Here's how you can show your support:
🌟 Patreon:   / llamacademy  
🌟 YouTube Member:    / @llamacademy   or click the Join button on any video
📚 Take my Unity ShaderGraph Course:
https://www.gamedev.tv/p/unity-shader...
👕 Get yourself some LlamAcademy merch: https://llamacademy.myspreadshop.com/
💸 Use my Affiliate Link for Humble Bundles https://humblebundleinc.sjv.io/9g4ak4
💸 Publisher Sale! 50% OFF an entire publisher's Assets! Publisher changes weekly! https://assetstore.unity.com/publishe... (affiliate)
💸 Save up to 50% on NEW Assets: https://assetstore.unity.com/?new_sal... (affiliate)

Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.

Chapters:
00:00 Introduction
02:18 MainMenu UXML
04:52 Add Gun Selector to Attachment Document Controller
05:51 Initial MainMenuController to go to Loadout
07:37 Demo
08:15 Begin Save
09:07 Save Data - IDataService.cs
09:41 Save Data - JsonDataService.cs
11:31 Load Data - JsonDataService.cs
12:50 Persistence Data Model - Loadout.cs
13:12 Save Loadout - AttachmentDocumentController.cs
14:30 Load Data - AttachmentDocumentController.cs
15:07 Refactor to Prevent Errors on Start
15:52 Demo
16:55 What's Left for the UI?
17:27 Menu Navigation Handling
20:30 Change Gun via Dropdown
25:46 Apply Loadout from Save & Spawn with correct gun
29:22 Final Demo
30:12 Closing Thoughts & Support LlamAcademy