Spontaneous removal of objects from the scene

</>
Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
UnloadTime: 4.742833 ms
NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.CSharp.RuntimeBinder.Semantics.ExpressionTreeRewriter.VisitBoundLambda (Microsoft.CSharp.RuntimeBinder.Semantics.ExprBoundLambda anonmeth) [0x00000] in <00000000000000000000000000000000>:0
at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.BindCore (Microsoft.CSharp.RuntimeBinder.ICSharpBinder payload, System.Linq.Expressions.Expression parameters, System.Dynamic.DynamicMetaObject args, System.Dynamic.DynamicMetaObject& deferredBinding) [0x00000] in <00000000000000000000000000000000>:0
at Microsoft.CSharp.RuntimeBinder.RuntimeBinder.Bind (Microsoft.CSharp.RuntimeBinder.ICSharpBinder payload, System.Linq.Expressions.Expression parameters, System.Dynamic.DynamicMetaObject args, System.Dynamic.DynamicMetaObject& deferredBinding) [0x00000] in <00000000000000000000000000000000>:0
at Microsoft.CSharp.RuntimeBinder.BinderHelper.Bind (Microsoft.CSharp.RuntimeBinder.ICSharpBinder action, Microsoft.CSharp.RuntimeBinder.RuntimeBinder binder, System.Dynamic.DynamicMetaObject args, System.Collections.Generic.IEnumerable1[T] arginfos, System.Dynamic.DynamicMetaObject onBindingError) [0x00000] in <00000000000000000000000000000000>:0 at System.Dynamic.DynamicMetaObjectBinder.Bind (System.Object[] args, System.Collections.ObjectModel.ReadOnlyCollection1[T] parameters, System.Linq.Expressions.LabelTarget returnLabel) [0x00000] in <00000000000000000000000000000000>:0
at System.Runtime.CompilerServices.CallSiteBinder.BindCore[T] (System.Runtime.CompilerServices.CallSite1[T] site, System.Object[] args) [0x00000] in <00000000000000000000000000000000>:0 at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <00000000000000000000000000000000>:0 at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00000] in <00000000000000000000000000000000>:0 at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00000] in <00000000000000000000000000000000>:0 at System.Linq.Expressions.Interpreter.LightLambda.RunVoid3[T0,T1,T2] (T0 arg0, T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0 at ShopItemViewFactory.Get (ShopItem shopItem, UnityEngine.Transform parent) [0x00000] in <00000000000000000000000000000000>:0 at ShopPanel.Show (System.Collections.Generic.IEnumerable1[T] items) [0x00000] in <00000000000000000000000000000000>:0
— End of stack trace from previous location where exception was thrown —

at System.Linq.Expressions.Interpreter.MethodInfoCallInstruction.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Interpreter.Interpreter.Run (System.Linq.Expressions.Interpreter.InterpretedFrame frame) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Expressions.Interpreter.LightLambda.RunVoid3[T0,T1,T2] (T0 arg0, T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0
at ShopItemViewFactory.Get (ShopItem shopItem, UnityEngine.Transform parent) [0x00000] in <00000000000000000000000000000000>:0
at ShopPanel.Show (System.Collections.Generic.IEnumerable`1[T] items) [0x00000] in <00000000000000000000000000000000>:0

Unloading 2 unused Assets to reduce memory usage. Loaded Objects now: 8328.
Total: 4.829834 ms (FindLiveObjects: 0.916917 ms CreateObjectMapping: 0.466750 ms MarkObjects: 3.387084 ms DeleteObjects: 0.058375 ms)
</>

This problem only occurs when building the game on iPhone, on PC everything works fine

This smells a little bit like code stripping.

I say that because the stack starts with your ShopPanel and goes into the ShopItemViewFactory, hits a Linq expression and starts doing some reflection and then blows up trying to (I think) bind some method in.

But why all works on PC? Can be some problem with build setting in unity for Ios?

Hey!

Have you tried switching PC to IL2CPP to see if it then also has the issue? (IL2CPP is the scripting backend on iOS)