Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getting MissingReferenceException from the component pool when I destroy a spline
#3
With the destruction, I am doing something a bit different.  I have a vast, complex scene hierarchy on top of a single parent object and the simplest way to destroy it was recursively, so I've got an extension method on GameObject that does that:

Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

internal static class ExtendUnityObjects
{
    /// <summary>
    /// Destroys all child GameObjects recursively.
    /// </summary>
    public static void DestroyRecursively(this GameObject go)
    {
        for (int i = go.transform.childCount - 1; i >= 0; i--)
        {
            go.transform.GetChild(i).gameObject.DestroyRecursively();
        }

        GameObject.Destroy(go);
    }
}

There are other methods in this class, but they don't interact with this method so I haven't included them.  The recursive function only gets called once to reset the geometry, then the objects shouldn't be touched after that by my code.

The error is coming from Assets/Plugins/DevTools/Components/ComponentPool.cs:318, so it's not really my code that's throwing the error, which is why I decided to ask about it.

I should also mention that the DevTools folder is from CurvySplines, I've just moved all my plugins & libraries into a plugin folder.

As for the shapes along the spline, I didn't explain properly, I'm trying to extrude along the spline, but change the size & shape of the extrusion as I go.  I will be roughly circular.  Ideally I'd like to be able to vary the mesh geometry along the length of the spline, including adding noise and adjusting the number of radial segments, but I understand if that's beyond the scope of this plugin.

If I can't vary this stuff within the plugin, I may simply be able to generate the mesh with the splines, then adjust the vertex positions using my own code, but obviously the less I have to do manually the better.
Reply


Messages In This Thread
RE: Getting MissingReferenceException from the component pool when I destroy a spline - by Excrubulent - 11-22-2020, 05:46 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curvy Line Renderer for UI Spline? gekido 3 6 04-04-2024, 12:56 PM
Last Post: _Aka_
  Get position of all control points for a spline gekido 1 6 03-28-2024, 10:08 PM
Last Post: _Aka_
Bug Changing spline connection in inspector causes splines to revert to defaults lacota 3 6 03-18-2024, 07:55 PM
Last Post: _Aka_
  GO can't fit end of the spline GameDeveloperek4123 3 14 03-04-2024, 11:06 AM
Last Post: _Aka_

Forum Jump: