How to Use Dictionaries in Unity and C# [BEGINNER FRIENDLY]

Опубликовано: 25 Январь 2021
на канале: Wild Cockatiel Games
9,292
206

In this video we'll be taking a look at how to use dictionaries in Unity and C#. EXPAND DESCRIPTION FOR TIMESTAMPS!!!

I encourage you to watch the whole thing, but you can use the timestamps to skip to the relevant sections:

0:25 - Goals of the video
1:15 - What is a C# dictionary?
3:12 - Example of dictionaries in Portal Galaxy (front-end)
3:55 - Example of dictionaries in Portal Galaxy (back-end)
5:47 - When to use a dictionary
7:47 - Working example of how we will code a dictionary (front-end)
8:27 - Working example of how to code dictionaries (back-end)
10:12 - How to DECLARE a dictionary
10:34 - How to ADD to dictionaries (simple way, may cause errors)
11:29 - How to RETRIEVE values from dictionaries (simple way, may cause errors)
13:37 - How to ADD to dictionaries (advanced way, prevents errors)
15:22 - How to RETRIEVE values from dictionaries (advanced way, prevents errors)
18:17 - Wrap-up

This can be an awfully complicated topic so I wanted to present this with plenty of examples and break it down so even beginners can understand the power of dictionaries, and know exactly how to implement them.

Dictionaries consist of two parts. A KEY and a VALUE. The key is used to retrieve a specific value from the dictionary, making them incredibly useful tools for accessing information you want, without any of the clutter in the way.

Try our game PORTAL GALAXY for Android here: https://bit.ly/PG_WCG
ZOMBIE BARREL BLAST signups here: http://bit.ly/WCG_ZBB
Watch my video on using GameObject.Find here:    • How to Use FindObjectOfType() in Unit...  

Music Attribution at video start:
Shades of Spring by Kevin MacLeod
Link: https://incompetech.filmmusic.io/song...
License: https://filmmusic.io/standard-license