diff --git a/Assets/Scripts/Game/Entity.cs b/Assets/Scripts/Game/Entity.cs index a72f7f7..78d68a8 100644 --- a/Assets/Scripts/Game/Entity.cs +++ b/Assets/Scripts/Game/Entity.cs @@ -1,5 +1,4 @@ using UnityEngine; -using UnityEngine.Rendering; public class Entity { @@ -142,9 +141,9 @@ public class Entity return; var skins = aliasModel.Textures.Skins; - if (skinNumber >= 0 && skinNumber < skins.Count) + if (skins.Count > 0) { - var skin = skins[skinNumber]; + var skin = skins[skinNumber >= 0 && skinNumber < skins.Count ? skinNumber : 0]; if (skin.Frames.Count > 0) visualStyle.SetAliasModelTextures(material, skin.Frames[0].MainTexture, skin.Frames[0].FullBrightTexture); } diff --git a/Assets/Scripts/Support/AliasModel.cs b/Assets/Scripts/Support/AliasModel.cs index 1cbe976..caa18e2 100644 --- a/Assets/Scripts/Support/AliasModel.cs +++ b/Assets/Scripts/Support/AliasModel.cs @@ -105,7 +105,7 @@ public class AliasModel for (int frameIdx = 0; frameIdx < header.numFrames; ++frameIdx) { // Individual sequences are identified by their prefix - string frameName = AnimationRegex.Match(header.frames[frameIdx].name).Value; + string frameName = AnimationRegex.Match(header.frames[frameIdx].name ?? "").Value; if (animName == null) { animName = frameName; diff --git a/Assets/Scripts/Support/BrushModel.cs b/Assets/Scripts/Support/BrushModel.cs index cc508f0..e2e13be 100644 --- a/Assets/Scripts/Support/BrushModel.cs +++ b/Assets/Scripts/Support/BrushModel.cs @@ -104,7 +104,7 @@ public class BrushModel { for (int vertIdx = 0; vertIdx < polyVerts.Length; ++vertIdx) { - tempVertices.Add(polyVerts[vertIdx].position.ToVector3().ToUnity()); + tempVertices.Add(polyVerts[vertIdx].position.ToUnityPosition()); tempTextureUVs.Add(polyVerts[vertIdx].textureUV.ToVector2()); tempLightmapUVs.Add(polyVerts[vertIdx].lightmapUV.ToVector2()); }