12-03-2019, 05:59 PM
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
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
Returns null
CreateGameObject then accesses Identifier of the null value -> NullRef Exception:
CreateGameObject.cs
As a quickfix for my problem, I could change GetPrefabPool to:
removing the unique id and having one pool for each prefab. Do you think that this might cause other problems?
Thanks in advance!
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;
}
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);
}
Thanks in advance!