In UnityEngine.Purchasing.PurchasingManager
private void CheckForInitialization()
{
if (!this.initialized)
{
bool flag = false;
foreach (Product product in this.products.set)
{
if (!product.availableToPurchase)
this.m_Logger.LogFormat(LogType.Warning, "Unavailable product {0} -{1}", (object) product.definition.id, (object) product.definition.storeSpecificId);
else
flag = true;
}
if (flag)
this.m_Listener.OnInitialized((IStoreController) this);
else
this.OnSetupFailed(InitializationFailureReason.NoProductsAvailable);
this.initialized = true;
}
else
{
if (this.m_AdditionalProductsCallback == null)
return;
this.m_AdditionalProductsCallback();
}
}
I find this:
if (flag)
this.m_Listener.OnInitialized((IStoreController) this);
else
this.OnSetupFailed(InitializationFailureReason.NoProductsAvailable);
this.initialized = true;
```
I suggest this:
```
this.initialized = true;
if (flag)
this.m_Listener.OnInitialized((IStoreController) this);
else
this.OnSetupFailed(InitializationFailureReason.NoProductsAvailable);
Imagine this in UnityEditor(Just in UnityEditor):
public void OnInitialized (IStoreController controller, IExtensionProvider extensions)
{
this.controller = controller;
this.extensions = extensions;
......
this.controller.FetchAdditionalProducts(...)
}
I don’t know whether it make sense or not~
JokeMaker:
In UnityEngine.Purchasing.PurchasingManager
private void CheckForInitialization()
{
if (!this.initialized)
{
bool flag = false;
foreach (Product product in this.products.set)
{
if (!product.availableToPurchase)
this.m_Logger.LogFormat(LogType.Warning, "Unavailable product {0} -{1}", (object) product.definition.id, (object) product.definition.storeSpecificId);
else
flag = true;
}
if (flag)
this.m_Listener.OnInitialized((IStoreController) this);
else
this.OnSetupFailed(InitializationFailureReason.NoProductsAvailable);
this.initialized = true;
}
else
{
if (this.m_AdditionalProductsCallback == null)
return;
this.m_AdditionalProductsCallback();
}
}
I find this:
if (flag)
this.m_Listener.OnInitialized((IStoreController) this);
else
this.OnSetupFailed(InitializationFailureReason.NoProductsAvailable);
this.initialized = true;
```
I suggest this:
```
this.initialized = true;
if (flag)
this.m_Listener.OnInitialized((IStoreController) this);
else
this.OnSetupFailed(InitializationFailureReason.NoProductsAvailable);
Imagine this in UnityEditor(Just in UnityEditor):
public void OnInitialized (IStoreController controller, IExtensionProvider extensions)
{
this.controller = controller;
this.extensions = extensions;
......
this.controller.FetchAdditionalProducts(...)
}
I don’t know whether it make sense or not~
Thank you for your report, this may cause the following loop, I will confirm with the development team.
CheckForInitialization() → this.m_Listener.OnInitialized((IStoreController) this); → FetchAdditionalProducts → CheckForInitialization()
Why would you call FetchAdditionalProducts in Intialization, what would be the use case?
Our project has hundreds of iap products. We want to fetch some of them first and then others.
Hello,
I can confirm this is still causing an endless loop, but we have plans to fix this.
Until then, would calling FetchAdditionalProducts after the initialization is done be an option to avoid this?