Json's, Classes, and Strings
Introduction
This fortnight I spent my time trying to work on converting JSON files into a class. I spent most of the time doing research and have made some headway but haven't refined the project just yet.
Goals
- Convert a JSON to a usable CS file.
- Use the information stored in the CS file to create an object or weapon.
Personnel
Primary – Ryley Delaney | Secondary – Jed May, Zack Camille |
Technologies, Tools, and Resources used
Provide resource information for team members who wish to learn additional information from this spike.
Writing to files in c#/unity:
- creating text files: https://youtu.be/6bVcLSZWqK8 accessed 20/8/2019
- classes vs structs: https://youtu.be/G5KJolM2uzs accessed 9/08/2019
- JSON Serialization: https://docs.unity3d.com/Manual/JSONSerialization.html accessed 20/08/2019
- File.WriteAllText: https://docs.microsoft.com/en-us/dotnet/api/system.io.file.writealltext?view=netframework-4.8 accessed 20/08/2019
What we found out
When writing to a CS file, the file still needs to be formatted in such a way to accommodate the syntax of C#. Therefore if a file is changed between formats, then the syntax will no longer work. This makes the process much more difficult however I have atleast managed to load the data from the JSON to a c# file. I'm now looking at ways to format the file based on each class with the line "ID" and create a seperate Weapon class based off those. This means using for loops.
SGD300 Dungeon Siege Project
A series of small tasks and blog posts about the creation of a small project reminiscent of Dungeon Siege
Status | Prototype |
Author | Ryley D. |
Genre | Adventure |
Tags | Game Design, Unity |
More posts
- Bird AI and InheritanceSep 23, 2019
- Weapon and Enemy AttributesSep 13, 2019
- Brushing Up on Source ControlSep 09, 2019
- UI AttributesAug 04, 2019
Leave a comment
Log in with itch.io to leave a comment.