diff --git a/Plugins/TurboLibrary/FileData/Byaml/Serialization/ByamlSerialize.cs b/Plugins/TurboLibrary/FileData/Byaml/Serialization/ByamlSerialize.cs index 6536661..a2ba873 100644 --- a/Plugins/TurboLibrary/FileData/Byaml/Serialization/ByamlSerialize.cs +++ b/Plugins/TurboLibrary/FileData/Byaml/Serialization/ByamlSerialize.cs @@ -118,6 +118,12 @@ static dynamic SetDictionary(object section) bymlProperties.Add("Z", ((ByamlVector3F)section).Z); return bymlProperties; } + if (section is UnitObject) + { + //Generate a unit ID unique to the object if set to 0 + if (((UnitObject)section).UnitIdNum == 0) + ((UnitObject)section).UnitIdNum = UnitIDRng.Next(0, 100000); + } var properties = section.GetType().GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); var fields = section.GetType().GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);