Skip to content

Commit

Permalink
init ScriptableObject instance properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Eddio0141 committed Oct 28, 2023
1 parent d50cbf1 commit 18a8046
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion UniTAS/Patcher/Utils/DeepCopy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ private static object MakeDeepCopy(object source, Func<string, Traverse, Travers
// }

StaticLogger.Trace("MakeDeepCopy, creating new instance and copying fields");
var result = AccessTools.CreateInstance(type);
var result = source is ScriptableObject
? ScriptableObject.CreateInstance(type)
: AccessTools.CreateInstance(type);
// guaranteed to be a reference type
foundReferences.Add(id, source);
newReferences.Add(id, result);
Expand Down

0 comments on commit 18a8046

Please sign in to comment.