Questions tagged [serialization]

conversion of program state into a storeable format

Filter by
Sorted by
Tagged with
0
votes
2answers
56 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
37 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
10 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
42 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
24 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
100 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
67 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
70 views

Is it possible to serialize both abstract and reference types in the same field of a generic class?

Say you have the following code: ...
0
votes
0answers
39 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
340 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
30 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
70 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
29 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
366 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
23 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
88 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
457 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
419 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
189 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
208 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
312 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
571 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
335 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
3k 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
362 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
246 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
423 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
78 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
390 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
3k 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
828 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
62 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
38 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
105 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
152 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
519 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
107 views

Unitys [SerializeField] and parallel inheritance

I have the following: ...
3
votes
0answers
559 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
140 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
731 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 ...
9
votes
2answers
2k views

How to make a field visible (attachable) in the inspector but inaccessible through code (private-like)?

Let's say I have a variable named button of type Button which is of course ...
0
votes
0answers
519 views

Serializing and writing a Dictionary of Vector2 keys and custom class values in Unity

I have tried to create code to serialize a Dictionary of <Vector2, Block>, where Block is a custom serializable class, loosely based off of this guide. I need ...
0
votes
0answers
244 views

Unity - Serializing a single property or UnityEngine.Object reference

When I call new SerializedObject(obj) where 'obj' is a UnityEngine.Object instance, as I understand it this is what it does: Each serializable property of the object is traversed, and its sub-...
0
votes
1answer
65 views

Saving Very Little Data But for Lots of Objects

Imagine 50 instances of one type of object and 25 instances of another. Both types of object needs to remember a simple Boolean or int for their own purposes that can be saved to file and reloaded. ...
1
vote
0answers
379 views

C++ Class to Void Pointer, Data Lost? [closed]

Reaching out yet again for a point in the right direction. Specifically, I am casting a simple struct to a void pointer so it can be sent out on the network, but it is cutting off my second variable ...
1
vote
1answer
499 views

Way to deserialized or load last save state scene with GameObject and other classes instead of storing normal fields via binary format?

I humbly ask for help in order to solve this problem. I successfully take a quick guide to learn more about save and load state of the game. Basically first, I know how to use ...
1
vote
1answer
3k views

Serialize ScriptableObject without creating an asset out of it?

Is it possible to do something like this? ...
1
vote
1answer
1k views

Binary Serialization and Protocol

i found this page Protocols. I'm currently working on a game similar to agario and i find that page is helpful for my game. They using WebSocket for sending game messages which is mine too. But i'm ...