Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pool Manager Nullref
#1
Hey, I have a problem with CurvySplines

I have a generator with a lot of create game object CGModules.
It seems like every CGModule will create its own set of pools as it differs in its Unique Id. 

CGModule.cs
Code:
protected PrefabPool GetPrefabPool(GameObject prefab)
{
     return Generator.PoolManager.GetPrefabPool(UniqueID.ToString(System.Globalization.CultureInfo.InvariantCulture) + "_" + prefab.name, prefab);
}

It got so bad that I get hudge performance drops when opening the Generator in the inspector.
So I decided to disable Auto Create Pools.

The problem is, that I then run into a nullref exception:

PoolManager.cs
Code:
public PrefabPool GetPrefabPool(string identifier, params GameObject[] prefabs)
{
      if (!IsInitialized)
            Initialize();
      IPool pool;
      if (!Pools.TryGetValue(identifier, out pool))
      {
            if (AutoCreatePools)
                pool = CreatePrefabPool(identifier, null, prefabs);
      }
      return (PrefabPool)pool;
}
Returns null


CreateGameObject then accesses Identifier of the null value -> NullRef Exception:

CreateGameObject.cs
Code:
string poolIdent = GetPrefabPool(VGO[id].Object).Identifier;


As a quickfix for my problem, I could change GetPrefabPool to:
Code:
protected PrefabPool GetPrefabPool(GameObject prefab)
{
      return Generator.PoolManager.GetPrefabPool(prefab.name, prefab);
}
removing the unique id and having one pool for each prefab. Do you think that this might cause other problems?

Thanks in advance!
Reply


Messages In This Thread
Pool Manager Nullref - by Wanderfalke - 12-03-2019, 05:59 PM
RE: Pool Manager Nullref - by _Aka_ - 12-03-2019, 08:00 PM
RE: Pool Manager Nullref - by Wanderfalke - 12-04-2019, 08:51 AM
RE: Pool Manager Nullref - by _Aka_ - 12-04-2019, 11:12 AM
RE: Pool Manager Nullref - by Wanderfalke - 12-04-2019, 11:57 AM
RE: Pool Manager Nullref - by _Aka_ - 12-04-2019, 12:40 PM
RE: Pool Manager Nullref - by _Aka_ - 12-04-2019, 01:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Getting MissingReferenceException from the component pool when I destroy a spline Excrubulent 5 1,898 11-22-2020, 11:38 AM
Last Post: _Aka_
Sad Spawning Controller Prefab with Matched Spline Prefab Using Pool Manager Kerkenez 10 17,132 03-29-2016, 08:19 PM
Last Post: Kerkenez

Forum Jump: