Open Razenpok opened 1 year ago
I can confirm this. It became a problem in our project. It causes 1 MB allocation by doing 16500 method calls on every scene load. And we don't even use CodelessIAP.
If you are not using CodelessIAP, Just remove it. Why bother optimize? If something goes wrong just return null. What could possible go worng :D
Checklist
Environment
Describe your dev environment here, giving as many details as possible. If you have them, make sure to include:
2021.3.25f1
15.1.0
Any platform
Code Samples & Details
As per Unity docs
FacebookSDK goes through assemblies one by one during the search for
IAPButton
class fromUnityEngine.Purchasing
:https://github.com/facebook/facebook-sdk-for-unity/blob/b8db43b2b6006e2cf698cf42cba8205d94c71472/Facebook.Unity/Utils/CodelessIAPAutoLog.cs#L103
Again, the generated GC memory from Assembly.GetTypes() is permanent, as it won't ever be collected.
This issue could be fixed with the following steps:
addListenerToIAPButtons
completely, as not all projects use codeless IAP buttons