You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using RPC's, NetworkedVar's or any other MLAPI related task that requires serialization. The MLAPI uses a default serialization pipeline that looks like this:
7
+
7
8
``
8
9
Custom Types => Built In Types => IBitWritable
9
10
``
10
11
11
12
That is, when the MLAPI first gets hold of a type, it will check for any custom types that the user have registered for serialization, after that it will check if it's a built in type, such as a Vector3, float etc. These are handled by default. If not, it will check if the type inherits IBitWritable, if it does, it will call it's write methods.
12
13
14
+
The builtin types that are handled by default are:
15
+
16
+
* Nullable types where the underlying type is supported
17
+
* An array where the element type is supported (can be multi dimensional as this is done recursivley)
18
+
* Byte
19
+
* SByte
20
+
* UInt16
21
+
* Int16
22
+
* UInt32
23
+
* Int32
24
+
* UInt64
25
+
* Int64
26
+
* Single
27
+
* Double
28
+
* String
29
+
* Bool
30
+
* Vector2
31
+
* Vector3
32
+
* Vector4
33
+
* Color
34
+
* Color32
35
+
* Ray
36
+
* Quaternion
37
+
* Char
38
+
* Enums
39
+
* GameObject (Only if the GameObject has a NetworkedObject component that is spawned)
40
+
* NetworkedObject (Only if spawned)
41
+
* NetworkedBehaviour (Only if spawned)
42
+
13
43
With this flow, you can override **ALL** serialization for **ALL** types, even built in types, and with the API provided, it can even be done with types that you have not defined yourself, those who are behind a 3rd party wall, such as .NET types.
14
44
15
-
To do this, register a handler pair:
45
+
To register a custom type, or override an already handeld type you need to register a handler pair.
16
46
17
47
```csharp
18
48
// Tells the MLAPI how to serialize and deserialize Url in the future.
Everytime you call the Register method, you are overriding any previous serialization method previously defined by you, or the MLAPI library. This is the most respected serialization method.
37
67
38
68
39
-
If you manually want to restore privilages to how they were previously for a type, you can use:
69
+
You can also restore privilages to how they were previously for a type.
0 commit comments