Comments

  • The TransformData class is the serializable primitive object storing the raw transform data extracted from the transform component. However, for the JSON serializer, we'll use the Vector3 and Quaternion data types, as these serialize to a file without issues.
  • In the Awake function, all transform components are found using the Object.FindObjectsOfType function. This generates an array of found transform components in the TransformArray class variable.
  • The SaveData function is run to serialize all transform components in the scene to a specified JSON file in Application.persistentDataPath. This method only serializes all objects currently in the scene, and it assumes that each object has a unique name.
  • The SaveData function begins ...

Get Mastering Unity 2017 Game Development with C# - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.