The concept of Serialization and deserialization is used whenever data pertaining to objects have to be sent from one application to another. Serialization is used to export application data into a file. The destination application then uses deserialization to extract the data from the application for further use.
Serialization is a concept in which C# class objects are written or serialized to files. Let' say you had a C# class called Tutorial. And the class has 2 properties of ID and Tutorials name.
Serializing can be used to directly write the data properties of the Tutorial class to a file. Deserialization is used to read the data from the file and construct the Tutorial object again.
Let's look at an example of how we can achieve this.
In our example, we are going to perform the below high-level steps in the code
Create a class called Tutorial which has 2 properties, namely ID, and Name
We will then create an object from the class and assign a value of "1" to the ID property and a value of ".Net" to the name property.
We will then use serialization to serialize the above object to a file called Example.txt
Finally, we will use deserialization to deserialize the object from the file and display the values in the Console.
+----------------------------------------------------------------------------------------+
| If you have any questions post them in the comments and I'll do my best to answer them,|
+----------------------------------------------------------------------------------------+
don't click this: • Unity 3D Game Over - Coffin Dance | L...
don't click this: • Unity 3D New Animation | Low Poly Thi...
don't click this: • Unity 3D : what happen if you Merge t...
don't click this: • [UNITY3D] Cover + Shooting System - ...
?? Subscribe for more Devlogs: / @mrreadcode9341
Facebook:https://www.facebook.com/groups/75143...
Смотрите видео Unity 3d - How To Save & Lode Game / Data in Unity | C# Serialization & Deserialization онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь Mr ReadCode 06 Май 2020, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 391 раз и оно понравилось 14 людям.