All characters are now rotated to 0,0,0 when spawned

Fixed texture deletion error
This commit is contained in:
Katboi01 2024-03-30 12:29:20 +01:00
parent 3b4ec2ba92
commit 07e2c4d88c
2 changed files with 58 additions and 55 deletions

View File

@ -128,32 +128,33 @@ public class FateModelBuilder : MonoBehaviour
foreach (var asset in assetBundle.LoadAllAssets())
{
if (asset == null) { continue; }
else if (asset.GetType() == typeof(GameObject))
switch (asset)
{
if((asset as GameObject).name == "chr")
{
servant.BodyMain = asset as GameObject;
}
}
else if (asset.GetType() == typeof(Texture2D))
{
Texture2D tex = asset as Texture2D;
servant.Textures.Add(tex);
}
else if (asset.GetType() == typeof(Material))
{
servant.Materials.Add(asset as Material);
}
else if (asset.GetType() == typeof(TextAsset))
{
}
else if (asset.GetType() == typeof(AnimationClip))
{
}
else
{
//Error.Log(Color.yellow, asset.GetType().ToString());
//Debug.LogWarning(asset.GetType());
case GameObject go:
{
if (go.name == "chr")
{
go.transform.eulerAngles = Vector3.zero;
servant.BodyMain = go;
}
break;
}
case Texture2D tex:
{
servant.Textures.Add(tex);
break;
}
case Material mat:
{
servant.Materials.Add(mat);
break;
}
case TextAsset text:
case AnimationClip anim:
default:
//Error.Log(Color.yellow, asset.GetType().ToString());
//Debug.LogWarning(asset.GetType());
break;
}
}
@ -276,36 +277,38 @@ public class FateModelBuilder : MonoBehaviour
foreach (var asset in assetBundle.LoadAllAssets())
{
if (asset == null) { continue; }
else if (asset.GetType() == typeof(GameObject))
switch (asset)
{
if (asset.name.StartsWith("chr_"))
{
servant.BodyMain = asset as GameObject;
}
else if (asset.name.StartsWith("model_"))
{
Instantiate(asset, servant.transform);
}
}
else if (asset.GetType() == typeof(Texture2D))
{
Texture2D tex = asset as Texture2D;
servant.Textures.Add(tex);
}
else if (asset.GetType() == typeof(Material))
{
servant.Materials.Add(asset as Material);
}
else if (asset.GetType() == typeof(TextAsset))
{
}
else if (asset.GetType() == typeof(AnimationClip))
{
}
else
{
Error.Log(Color.yellow, asset.GetType().ToString());
Debug.LogWarning(asset.GetType());
case GameObject go:
{
if (asset.name.StartsWith("chr_"))
{
servant.BodyMain = go;
}
else if (asset.name.StartsWith("model_"))
{
Instantiate(asset, servant.transform);
}
break;
}
case Texture2D tex:
{
servant.Textures.Add(tex);
break;
}
case Material mat:
{
servant.Materials.Add(mat);
break;
}
case TextAsset tex:
case AnimationClip anim:
default:
{
Error.Log(Color.yellow, asset.GetType().ToString());
Debug.LogWarning(asset.GetType());
break;
}
}
}

View File

@ -130,7 +130,7 @@ public class FateServantContainer : MonoBehaviour
}
for (int i = Textures.Count - 1; i >= 0; i--)
{
Destroy(Textures[i]);
DestroyImmediate(Textures[i], true);
}
for (int i = InstantiatedObjects.Count - 1; i >= 0; i--)
{