Stop dialogue from breaking entirely if pathToAnimController is invalid

This commit is contained in:
Nick 2022-07-21 23:23:04 -04:00
parent 007ff3fa1b
commit 3587424bbb

View File

@ -4,6 +4,9 @@ using OWML.Common;
using System.IO;
using System.Xml;
using UnityEngine;
using NewHorizons.Utility;
using Logger = NewHorizons.Utility.Logger;
namespace NewHorizons.Builder.Props
{
public static class DialogueBuilder
@ -110,6 +113,12 @@ namespace NewHorizons.Builder.Props
{
var character = go.transform.Find(info.pathToAnimController);
if (character == null)
{
Logger.LogError($"Couldn't find child of {go.transform.GetPath()} at {info.pathToAnimController}");
return;
}
// At most one of these should ever not be null
var nomaiController = character.GetComponent<SolanumAnimController>();
var controller = character.GetComponent<CharacterAnimController>();