Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Unity Game Development with C#

You're reading from   Mastering Unity Game Development with C# Harness the full potential of Unity 2022 game development using C#

Arrow left icon
Product type Paperback
Published in Jul 2024
Publisher Packt
ISBN-13 9781835466360
Length 356 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Mohamed Essam Mohamed Essam
Author Profile Icon Mohamed Essam
Mohamed Essam
Arrow right icon
View More author details
Toc

Table of Contents (17) Chapters Close

Preface 1. Part 1: Game Design and Project Structure FREE CHAPTER
2. Chapter 1: An Introduction to Game Design and Project Management 3. Chapter 2: Writing Clean and Modular C# Code for Unity Game Development 4. Part 2: Advanced C# Game Development Techniques in Unity
5. Chapter 3: Extending Functionality with Unity Plugins 6. Chapter 4: Implementing Engaging Game Mechanics Using C# in Unity 7. Chapter 5: Designing Optimized User Interfaces with C# for Unity Games 8. Part 3: Data Management and Code Collaboration with C# in Unity
9. Chapter 6: Effective Game Data Handling and Management with C# in Unity 10. Chapter 7: Contributing to Existing Code Bases in Unity with C# 11. Part 4: Advanced Integration and External Assets with C# in Unity
12. Chapter 8: Implementing External Assets, APIs, and Pre-Built Components with C# in Unity 13. Chapter 9: Optimizing the Game Using Unity’s Profiler, Frame Debugger, and Memory Profiler 14. Chapter 10: Tips and Tricks in Unity 15. Index 16. Other Books You May Enjoy

Creating a UI system using C#

In this section, we will create a C# system for handling UI behavior, leveraging optimization tips and the MVC structure to achieve our objectives. This involves creating a UIManager class to oversee views, a BaseView class containing core view logic, and a practical example demonstrating the implementation of the UI system.

The UIManager class

To kick off this system, we’ll establish a base class called UIManager. This class will handle the invocation of show and hide functions for views and will act as a container for all the views. For each scene, we’ll create a child of UIManager, responsible for controlling the views within that specific scene. This scene-specific manager will hold all the views, providing us with better control over them. This setup allows us to hide all views, ensuring that only one view is active at a time, which is advantageous for performance.

The following code block provides a sample of the UIManager...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime