Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Mastering Unity 2D game development
  • Toc
  • feedback
Mastering Unity 2D game development

Mastering Unity 2D game development

By : Jackson
3.8 (21)
close
Mastering Unity 2D game development

Mastering Unity 2D game development

3.8 (21)
By: Jackson

Overview of this book

If you have C# knowledge but now want to become truly confident in creating fully functional 2D RPG games with Unity, then this book will show you everything you need to know.
Table of Contents (15 chapters)
close
Free Chapter
1
1. Overview
14
Index

Background tasks and Coroutines


Next up in the fabulous journey of scripting, we will cover the treacherous realm of background tasks. We use the background tasks to start something (in the background) so that it is runs independently of the normal game update and draw cycle.

Note

Coroutines, by default, run on the same thread as the normal game loop. If you are not careful, they can stop your game from running. (You can dispatch them on to separate threads in Unity Pro to offset the work in order to improve the performance.)

For more information on Coroutines and the default execution order of methods, refer to the article in the Unity docs at https://docs.unity3d.com/Documentation/Manual/ExecutionOrder.html.

The following diagram shows that we can have a second process that runs alongside our main game:

This is usually used for systems that are continually running and not for the main events on the screen, such as AI, a background trading system, or even a continual web-service-gathering data...

bookmark search playlist font-size

Change the font size

margin-width

Change margin width

day-mode

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Delete Bookmark

Modal Close icon
Are you sure you want to delete it?
Cancel
Yes, Delete