Created
November 14, 2014 09:22
-
-
Save balaam/ae6378ca4f149de36c6c to your computer and use it in GitHub Desktop.
Unity Serialiser Helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [System.Serializable] | |
| public struct SaveDataVector3 | |
| { | |
| float x, y, z; | |
| public SaveDataVector3(Vector3 v) | |
| { | |
| x = v.x; | |
| y = v.y; | |
| z = v.z; | |
| } | |
| public static implicit operator SaveDataVector3(Vector3 value) | |
| { | |
| return new SaveDataVector3(value); | |
| } | |
| public static implicit operator Vector3(SaveDataVector3 v) | |
| { | |
| return new Vector3(v.x, v.y, v.z); | |
| } | |
| } | |
| [System.Serializable] | |
| public struct SaveDataVector2 | |
| { | |
| float x, y; | |
| public SaveDataVector2(Vector2 v) | |
| { | |
| x = v.x; | |
| y = v.y; | |
| } | |
| public static implicit operator SaveDataVector2(Vector2 value) | |
| { | |
| return new SaveDataVector2(value); | |
| } | |
| public static implicit operator Vector2(SaveDataVector2 v) | |
| { | |
| return new Vector2(v.x, v.y); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment