Questions tagged [serialization]

Serialization is the process of converting a data structure or an object state into a different format for storing or network transmission purposes so that it can be reconstructed later.

Filter by
Sorted by
Tagged with
1
vote
1answer
17 views

Unity serialization with preprocessors

I am working on a Unity multiplayer game using mirror, and i separated server- and client-only code using partial classes and preprocessor #if statements based on this answer i found: https://gamedev....
0
votes
1answer
56 views

How do you use configuration files to describe the contents of an entity in an ECS-system?

One of the advantages that's often brought up when talking about ECS-systems is that they allow a higher degree of flexibility in regards to Data vs Code. Without the limitation of hard-coded types, ...
1
vote
1answer
62 views

Unity custom editor - nested Property Drawer is getting Enum names for the parent property, instead of the child

I have a class, EnumMap<TEnum,TValue>, for associating each member of an enum type with a value of a given type, since I find myself running into situations ...
0
votes
0answers
17 views

Understanding the EditorPrefs API in Unity

Context I was working on an editor window that had to toggle Preferences > General > AutoRefresh via script so I was using Unity's EditorPrefs API. Problem Editor prefs are saved not in yaml ...
0
votes
1answer
40 views

Serialize List of References

I have a list of object references inside a serializable class, like this: ...
1
vote
0answers
61 views

Unreal Engine 4.26: How to serialize and load the array of custom UObjects (TArray<UObject*>) in C++?

I have a UProperty in struct which is a TArray<UCoverInfo*> where UCoverInfo is inherited from UObject: ...
0
votes
1answer
28 views

Getting info about the script a [PropertyAttribute] is attached to in Unity

Is there a way to access info about the script that a PropertyAttribute is part of in Unity? In my case: getting the memberInfos of the script: ...
0
votes
0answers
15 views

Saving and Loading Component Settings (Serialisation Help)

I am currently taking my first real steps into serialisation in Unity. To start with I thought I would try and save customisations to a weapon back to its data representation WeaponItem a ...
1
vote
1answer
150 views

Text Only Dungeon Crawler game. Hardcoding Maps vs Generating Map Data externally?

I am trying to make a text-only dungeon crawler game. The general structure for the game is in place (ie. a 'Level' is a 16x16 grid of 'Rooms'). ...
0
votes
2answers
127 views

Designing persistence in an ECS world subdivided into chunks

I'm designing a kind of simple open world with ECS. The whole world is too large to be loaded at once, so I load and unload chunks according to player's position. Nothing fancy, pretty much standard ...
0
votes
1answer
55 views

How to implement complex serializable property with internal GameObject field

I'm trying to create a complex serialized object with property drawer with assignable GameObject field. I want to make something like Binding. So that you could declare a field in an X Monobehaviour ...
0
votes
1answer
22 views

After setting a field using the editor API, the field gets cleared on Play in Unity. How to fix it?

After setting a field using the editor API, the field gets cleared on Play in Unity. How to fix it? I have a menu item. That menu item sets a field on one of my game objects in scene. After the field ...
0
votes
2answers
57 views

How can I serialize lists to JSON on mobile?

I'm having difficulties serializing lists with the built in JsonUtility. I eventually figured out this just isn't possible with its limited capabilities. As much as I'd like to use Newtonsoft, I ...
1
vote
0answers
65 views

How to serialize animation state?

In Unity, I have an Animator on a character. Upon saving/loading the game, I want to preserve the pose and animation state the character is in. However, I can see no way to read/write all the data ...
0
votes
1answer
263 views

What is the difference between Serializable, and System.Serializable?

What is the difference between Serializable, and System.Serializable? I'm guessing ...
0
votes
1answer
100 views

Extending a ScriptableObject to have a get property instead of a field, without losing serialized data

I have a ScriptableObject that's already used extensively in my project: ...
0
votes
0answers
69 views

Alternative to Dictionary serialization

I am working on a set of ScriptableObjects that represent base stats for characters in my game. Think Strength, Speed, Intellect, etc. A whole laundry list of em (about 20 stats). I'd like to later be ...
0
votes
1answer
653 views

How do you de/serialize a monobehaviour class?

It seems JsonUtility.FromJson does not work for MonoBehaviour classes (and I can't get Newtonsoft to parse strings to Vector3s) Suppose you have a MonoBehaviour ...
0
votes
0answers
31 views

How to annotate a BinaryFormatter packet with a header describing its length?

I am working on a project that is sending data from pc to tablet via usb, using android adb. To serialize the data, we are using BinaryFormatter. The problem I'm running into is that the client is ...
0
votes
1answer
157 views

Deserialize only some fields from a JSON file

I'm trying to parse a very large JSON string in Unity. I do not need all the fields and I can't create a class with all the members. It appears that all examples I have found, including the official ...
0
votes
0answers
30 views

XML Serializer deleting player files

I've been getting reports from my users that sometimes the game isn't saving. I've recently been provided with the game save files from one of these reports and found all the XML files were completely ...
2
votes
1answer
780 views

Component instance reference in Unreal Engine 4

I'm creating a C++ script and I want to get a reference to a component instance. For example, imagine that I want to get the player camera, which is a ...
0
votes
0answers
50 views

Saving Complex Data to File Javascript

My game uses lots of complex objects to store game data. (Each block and entity has its own instance of a class) I am trying to create a saving and loading system, where the user can save game ...
-1
votes
1answer
106 views

Serializing game information over TCP connection

I'm trying to write a Unity client with C++ game server with TCP socket. When I'm sending game data back and forth with client and server, I'd want to serialize it in someway that can be deserialized ...
1
vote
1answer
713 views

Serializing nested ScriptableObjects with runtime changes

I'm making an effort to use ScriptableObjects more in my game architecture, after watching a fantastic Unity Unite talk on the subject. The central idea is to use ScriptableObjects, during runtime, as ...
0
votes
1answer
653 views

How to properly format classes for JSON deserialization with JSON.net for Unity?

**UPDATE: This answer has been solved and this post updated to ** I am creating an inventory system and decided to keep a master list of all the items. The goal is to use Newtonsoft's JSON.net to ...
0
votes
1answer
307 views

Unity editing List via Editor Script

I am currently working on an editor script for a custom component I created, I am using UIElements to do this, the UI is constructed and working all apart from when I try to modify a list item of the ...
1
vote
1answer
276 views

Json Libgdx serialize / de-serialize a Object Map of Object Maps

Any one have any ideas on how I can serialize / de-serialize an ObjectMap<Enum, ObjectMap<String, Object>>(); (Object is usually a String Integer ...
1
vote
0answers
399 views

How can I uniquely identify a GameObject in Unity?

I'm trying to serialize and deserialize my custom classes with Unity. I've got an ISerialize interface that mandates the class can ...
1
vote
1answer
768 views

Unity3D - JsonUtility returns empty string

i have the problem that when I convert an instance of highscores through JsonUtility.ToJson the value of my value of it is always {"highscoreEntryList":[{},{},{},{},{},{},{},{},{},{},{}]}... ...
1
vote
1answer
514 views

How to reference nameof private serialized field in unity custom inspector

I'm running into a problem that I think will seriously affect maintainability down the road, so I'd like to figure it out now before it becomes a problem. I've been starting to use private [...
1
vote
3answers
4k views

ScriptableObjects lose references/stored objects upon build/restarting the Unity Editor?

I'm working on implementing room prefabs for my 2D procedural map generation algorithm. Basically I made a tool which parses a scene's monsters, items, etc into an ObjectContainer prefab, and into ...
1
vote
1answer
474 views

Saving and loading a GameObject's full state easily in Unity3D?

I'm working on placing predesigned tilemap rooms in my procedural dungeons, and I would like to design the items' and monsters' placement in these special rooms as well. Currently I "compile" my ...
1
vote
0answers
285 views

How would I go about serializing my LibGDX game?

I am currently using Kryo for serialization. I have a Player class, but it extends Sprite. Sprite isn't serializable. This means I can't serialize Player as a whole. Is there another way to do this? ...
0
votes
1answer
522 views

Fast Serialization for Multiplayer Gaming

I wish to make a Java based multiplayer game. I am learning all about sockets and so forth. I have built a very basic UDP system that serializes an object with all the information about the game state ...
0
votes
1answer
115 views

How to add to a MonoBehavior array from an Editor script in Unity

I've made an editor which makes a list of tags and splits them into two rows of true or false values (selectable by the user). I then compile this list into a dictionary, and each entry is like so: <...
0
votes
0answers
431 views

How does Unity store references to GameObjects in a scene

A Monobehaviour can have references to GameObjects in the same scene, but Prefabs, ScriptableObjects can't reference GameObjects in a scene. While Assets, Objects and serialization covers references ...
0
votes
1answer
3k views

Loading a list of items from JSON, all entries are null

(I posted a very similar question here recently and the response I received was helpful. But I have been advised to start a new question, and here it is.) I am developing a Unity game which includes ...
1
vote
1answer
4k views

Unity JSON parsing Array of Objects problem - error: JSON must represent an object type

I'm trying to use Json to hold game dialog in a text asset file. I've tried to make a barebones project to test this and it is failing with the Error Message: ArgumentException: JSON must represent an ...
0
votes
1answer
960 views

(Unity) Serializing Data with Custom Object Stored by Reference

I have a custom class that I serialize/deserialize to/from file(s), and is not guaranteed to be identical each time the game runs (in this example, a language pack. it's possible to fix a typo ...
0
votes
0answers
67 views

How to save Player's progress with variables?

I'm trying to save and load my Player's progress. I have a serialized class named "gamestate". This class contains all of the Player's progress, number of lives, total points, etc. That class also ...
1
vote
2answers
39 views

Update dependent values of Serializable C# classes on Inspector

I have some data types' properties that depend on the input given into other attributes, but I haven't found in the Unity's API an elegant way to update them automagically on the Inspector. As an ...
0
votes
1answer
110 views

Why is there no standard 3d file format that saves models as (collections of) primitives?

I have been looking around for a file format that saves models as a collection of primitives (Boxes, Spheres, Cones, Cylinders, etc.). After some research, I came to the conclusion that pretty much ...
-1
votes
1answer
162 views

Unity3D MonoBehaviour in .dll loses serialized data when dll is updated

I have a MonoBehaviour class in a compiled DLL that I have included in my Unity project. It automatically serializes public field data as expected. However, whenever I update the dll (by overwriting ...
0
votes
1answer
592 views

Serialization/Deserialization Solutions for Loading & Playing Audio Files

I'm creating a music game in unity, and the first issue I encountered was that I had no way to load music into the game from a file. I tried using a WWW to load the mp3 files, but in my research I ...
0
votes
1answer
150 views

Unitys [SerializeField] and parallel inheritance

I have the following: ...
3
votes
0answers
579 views

Making generic type T method as a layer of abstraction for Unty3D's EditorGUI field draw methods

I am making a visual tool for Editor Window on Unity3D, and I am just recently using System.Reflection methods to get class's assembly data, to get information about properties, fields and methods (...
0
votes
2answers
159 views

Unity: Component not being serialized

I have a script like this: public class A: MonoBehaviour { public bool x = false; } ... and a Custom Editor like this: ...
0
votes
2answers
739 views

Still having problems using Json data in Unity

I have the following classes and json file, i thought id followed the documentation exactly but I am clearly wrong. Can anyone see why I get an error just saying : INVALID VALUE in my unity console: ...
1
vote
1answer
9k views

How to create JSON file in notepad that will hold my positional vector3 data for one type of object

I'm trying to get my head around using JSON files to store level data . Specifically in this example is to make my walls. (its a top-down game like pacman). Each wall prefab is a 1x1x1 cube. I just ...