Search icon CANCEL
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
Game Development with Unity for .NET Developers

You're reading from   Game Development with Unity for .NET Developers The ultimate guide to creating games with Unity and Microsoft Game Stack

Arrow left icon
Product type Paperback
Published in May 2022
Publisher Packt
ISBN-13 9781801078078
Length 584 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Jiadong Chen Jiadong Chen
Author Profile Icon Jiadong Chen
Jiadong Chen
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface 1. Part 1: Basic Unity Concepts
2. Chapter 1: Hello Unity FREE CHAPTER 3. Chapter 2: Scripting Concepts in Unity 4. Part 2: Using C# Scripts to Work with Unity's Built-In Modules
5. Chapter 3: Developing UI with the Unity UI System 6. Chapter 4: Creating Animations with the Unity Animation System 7. Chapter 5: Working with the Unity Physics System 8. Chapter 6: Integrating Audio and Video in a Unity Project 9. Part 3: Advanced Scripting in Unity
10. Chapter 7: Understanding the Mathematics of Computer Graphics in Unity 11. Chapter 8: The Scriptable Render Pipeline in Unity 12. Chapter 9: The Data-Oriented Technology Stack in Unity 13. Chapter 10: Serialization System and Assets Management in Unity and Azure 14. Chapter 11: Working with Microsoft Game Dev, Azure Cloud, PlayFab, and Unity 15. Other Books You May Enjoy

The life cycle of a script instance

In the previous section, we introduced basic concepts of scripting in Unity. Now, we will explain another important topic regarding scripting in Unity: the life cycle of a script instance.

We already know that the Unity C# API does not include the internal logic of the engine and the event functions on the script are triggered by the engine's C/C++ code. Therefore, in order to use the Unity engine correctly, it is very important to understand the order of execution for event functions and the life cycle of a C# script in Unity.

We can divide the Unity event functions into the following categories depending on their purpose :

  • Initialization
  • Update
  • Rendering

Let's discuss them next.

Initialization

If you are familiar with developing .NET applications, you may be surprised by script initialization in Unity because Unity scripts do not use constructors for initialization. Instead, Unity provides some engine...

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