Skip to content

Commit 4a34093

Browse files
committed
fix: Fixed TypeReference deserialization issue in IL2CPP builds
1 parent 7ac325a commit 4a34093

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Runtime/TypeReference.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,18 @@ public class TypeReference : ISerializationCallbackReceiver
3131
private bool _needToLogTypeNotFound;
3232
private bool _typeChanged;
3333

34+
/// <summary>
35+
/// Initializes a new instance of the <see cref="TypeReference"/> class with Type equal to null.
36+
/// </summary>
37+
/// <remarks>
38+
/// The fully empty constructor without even named parameters is needed for the class to be deserialized in
39+
/// IL2CPP builds. For some reason, if the class doesn't have a fully empty constructor, OnAfterDeserialize
40+
/// will not be called in IL2CPP builds.</remarks>
41+
public TypeReference()
42+
{
43+
_suppressLogs = false;
44+
}
45+
3446
/// <summary>
3547
/// Initializes a new instance of the <see cref="TypeReference"/> class with Type equal to null.
3648
/// </summary>

0 commit comments

Comments
 (0)