When returning to my Argon Assaut project today, Unity had lost the reference to the parent for my enemy deathFX and wouldn’t let me reset it. So I came up with this script to add to the EnemyController
using UnityEngine;
private void SetParent()
{
if (parent = null)
{
parent = GameObject.Find("Spawned at Runtime").transform;
if (parent = null)
{
parent = new GameObject("Spawned at Runtime").transform;
}
}
}
but now I’m wondering if this is an acceptable way to protect against an ORIO (Object Reference not set to the Instance of an Object)?