Page 1 of 1

_Demo Error

Posted: Mon May 21, 2018 8:51 am
by martiallaw
Hello,
It is impossible for me to run the demo because of this error, I have the integrations activated and the propooling I am already using it in my project without any problem, what can happen?

NullReferenceException: Object reference not set to an instance of an object
ProPooling.Pool.Initialise () (at Assets/FlipWebApps/ProPooling/Scripts/Pool.cs:265)
GameFramework.Scrolling.Components.ParallaxLayer+SpawnableItem.Initialise (UnityEngine.Transform parent) (at Assets/FlipWebApps/GameFrameworkExtras/Scrolling/ParallaxLayer.cs:440)
GameFramework.Scrolling.Components.ParallaxLayer.Start () (at Assets/FlipWebApps/GameFrameworkExtras/Scrolling/ParallaxLayer.cs:166)
Screenshot_2.png
Screenshot_2.png (107.08 KiB) Viewed 8251 times

Re: _Demo Error

Posted: Fri May 25, 2018 9:45 am
by mahewitt
Hi,

Sorry for the delay in getting back. I took a closer look at this and it seems to be quite an obscure bug that crept in with the latest Pro Pooling update, but behind the scenes is caused by Unity not calling a constructor on the Pools (which is what is setup in the Parallax Layers through the editor). I am not even sure how that is possible, but setting breakpoints confirms this to be the case.

The workaround for now seems to be to manually recreate the pools. If you add the following to \FlipWebApps\GameFrameworkExtras\Scrolling\ParallaxLayer.cs at line 155 (just before the '// Setup for manual mode...') comment)

// For some reason the base constructor isn't called (not sure how that is possible)!!!
// We recreate the objects here to make sure they are setup correctly.
for (int i = 0; i < SpawnableItems.Length; i++)
{
var displayItem = SpawnableItems;
var displayItemNew = new SpawnableItem(displayItem.Prefab)
{
InitialSize = displayItem.InitialSize,
ProgressiveFill = displayItem.ProgressiveFill,
ProgressiveFillInitialAmount = displayItem.ProgressiveFillInitialAmount,
ProgressiveFillFrameInterval = displayItem.ProgressiveFillFrameInterval,
ProgressiveFillIntervalAmount = displayItem.ProgressiveFillIntervalAmount,
SizeExceededMode = displayItem.SizeExceededMode,
HasMaximumSize = displayItem.HasMaximumSize,
MaximumSize = displayItem.MaximumSize,
MaximumSizeExceededMode = displayItem.MaximumSizeExceededMode
};
SpawnableItems = displayItemNew;
}

That should stop the errors. There is also an issue with positioning of the Parallex items that I will look into seperately (currently everything seems to overlap)

Let me know if that helps.

Regards,
Mark