Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Serializable Types #19

Closed
hasanbayatme opened this issue Jul 27, 2017 · 1 comment
Closed

Add Serializable Types #19

hasanbayatme opened this issue Jul 27, 2017 · 1 comment
Assignees

Comments

@hasanbayatme
Copy link
Member

Hi.

I have found some Unity types such as Vector3, Quaternion, ... does not support serialization, while we need to serialize them.

So, it is good idea to make an serializable version of them. for example Vector3Serializable.

Here is a simple example using SerializableAttribute: (Have a look at examples link at below to get idea)

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[Serializable]
public struct Vector3Serializable {

    public float x;
    public float y;
    public float z;

    // Place Constructors

    // Do implicit conversion between Vector3 and Vector3Serializable

}

Or by using ISerializable interface.

Now, the list of types that we can make:

  • Vector4 -> Vector4Serializable | Example
  • Vector3 -> Vector3Serializable | Example
  • Vector2 -> Vector2Serializable | Example
  • Mesh -> MeshSerializable | Example
  • Quaternion -> QuaternionSerializable | Example
  • Color - ColorSerializable | Example
  • Color32 -> Color32Serializable | Example
  • Let me know if i have missed one.

Also, we can add some more serializable custom types such as SerializableDictionary, SerializableCollection or SerializableList.

Or even some custom classes such MyCustomType.

Also there might be some unserializable types in System types.

Thanks.

@hasanbayatme hasanbayatme self-assigned this Jul 27, 2017
hasanbayatme added a commit that referenced this issue Jul 28, 2017
Add Serializable Types #19
Update Old #15
Add Test Scene #20
Add Tests Folder (PlayMode & EditMode) #20
Enable PlayMode Testing #20
@hasanbayatme
Copy link
Member Author

Added, Close #19.

If you need more serializable types just let us know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant