Make the logic after the first frame or make the logic in many steps (edit) render is killing the frames with very simple scene

Hello,

I have a problem when the game opens the first scene in my game it crashes on mobile(not always), I tested another scene and it works well, so it is a performance issue, the scene gets all the data from the save system I am using (BinaryFormatter) and one canvas with slider to load the next scene, I think that the problem that a do a lot of for loops in the start so I want to make it work in the next frame like this video said:

How can I move my logic to the next frame, or how can I make this logic take his time because it is a loading scene so no problem to take more time but not being crash
and thanks for helping.

EDIT

After some profiling, I found that it is not my script is the problem, it is the render, but it is a very simple scene so can anyone help me to find the reason.

There is some pis of the scene and how the profiler looks


Every time your game crashes what you need to do is not to profile but to find crash logs (.log files) for these events and search for "crash" word there (or last message in some rare cases) - callstacks will tell you tell you the all the story of what happened there.

Sorry for the delay in responding but this is what I came up with, any idea about these errors?

10-06 16:20:31.286  6543  6543 E AndroidRuntime: FATAL EXCEPTION: main
10-06 16:20:31.286  6543  6543 E AndroidRuntime: Process: com.emeint.android.myservices, PID: 6543
10-06 16:20:31.286  6543  6543 E AndroidRuntime: android.os.BadParcelableException: Parcelable encountered IOException writing serializable object (name = vodafone.vis.engezly.cash_moneytransfer.presentation.views.VfCashMoneyTransferConfirmationView)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeSerializable(Parcel.java:2763)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2529)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2328)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeArrayMapInternal(Parcel.java:1277)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Bundle.writeToParcel(Bundle.java:1362)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeBundle(Parcel.java:1346)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at androidx.fragment.app.FragmentState.writeToParcel(:159)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeParcelable(Parcel.java:2550)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2451)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2328)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeArrayMapInternal(Parcel.java:1277)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Bundle.writeToParcel(Bundle.java:1362)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeBundle(Parcel.java:1346)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2445)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2335)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeArrayMapInternal(Parcel.java:1277)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Bundle.writeToParcel(Bundle.java:1362)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeBundle(Parcel.java:1346)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2445)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2335)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeArrayMapInternal(Parcel.java:1277)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Bundle.writeToParcel(Bundle.java:1362)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeBundle(Parcel.java:1346)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2445)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeValue(Parcel.java:2335)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.BaseBundle.dumpStats(BaseBundle.java:1874)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.BaseBundle.dumpStats(BaseBundle.java:1911)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:150)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:942)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:226)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:313)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.app.ActivityThread.main(ActivityThread.java:8762)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at java.lang.reflect.Method.invoke(Native Method)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)10-06 16:20:31.286  6543  6543 E AndroidRuntime: Caused by: java.io.NotSerializableException: o.setShouldDownscaleFrameToDrawableDimensions
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1240)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1604)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1565)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1488)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1234)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:354)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        at android.os.Parcel.writeSerializable(Parcel.java:2758)
10-06 16:20:31.286  6543  6543 E AndroidRuntime:        ... 39 more

screenshot of the logcat window

@andrew-lukasik

This is the most informative line here:

android.os.BadParcelableException: Parcelable encountered IOException writing serializable object (name = vodafone.vis.engezly.cash_moneytransfer.presentation.views.VfCashMoneyTransferConfirmationView)

From what I understand from this log the code that is crashing is not part of Unity but the android system callbacks between applications. IOException in particular means that program fully expected write access to some file location but that access was denied by the device system for some reason (some user file settings or “out of free storage space” might caused this).

Also, not sure if that matters but this:

vodafone.vis.engezly.cash_moneytransfer.presentation.views.VfCashMoneyTransferConfirmationView

suggests that application was mid executing money payment processing view at the time of the exception.

I am no Android nor Java developer, so can’t give you more insightful answer than this. Ask one (show them the crash log) and they will tell you what went wrong here - one of the many Android developer forums might be a good place for that.

hi, I tried to test my game on another mobile and I think that I got good crash logs this time so can anyone help me with that

2023/10/16 21:25:37.105 29942 30017 Warn Adreno-GSL <sharedmem_gpuobj_alloc:2736>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
2023/10/16 21:25:37.105 29942 30017 Error Adreno-GSL <gsl_memory_alloc_pure:2614>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
2023/10/16 21:25:37.106 29942 30017 Warn Adreno-GSL <sharedmem_gpuobj_alloc:2736>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
2023/10/16 21:25:37.106 29942 30017 Error Adreno-GSL <gsl_memory_alloc_pure:2614>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
2023/10/16 21:25:37.108 29942 30017 Warn Adreno-GSL <sharedmem_gpuobj_alloc:2736>: sharedmem_gpumem_alloc: mmap failed errno 12 Out of memory
2023/10/16 21:25:37.108 29942 30017 Error Adreno-GSL <gsl_memory_alloc_pure:2614>: GSL MEM ERROR: kgsl_sharedmem_alloc ioctl failed.
2023/10/16 21:25:37.121 29942 30017 Error CRASH *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023/10/16 21:25:37.121 29942 30017 Error CRASH Version '2021.3.8f1 (b30333d56e81)', Build type 'Development', Scripting Backend 'mono', CPU 'armeabi-v7a'
2023/10/16 21:25:37.121 29942 30017 Error CRASH Build fingerprint: 'HONOR/ANY-LX2/HNANY-Q1:13/HONORANY-L22CQ/7.1.0.157C185E63R2P1:user/release-keys'
2023/10/16 21:25:37.121 29942 30017 Error CRASH Revision: '0'
2023/10/16 21:25:37.121 29942 30017 Error CRASH ABI: 'arm'
2023/10/16 21:25:37.123 29942 30017 Error CRASH Timestamp: 2023-10-16 21:25:37+0300
2023/10/16 21:25:37.123 29942 30017 Error CRASH pid: 29942, tid: 30017, name: UnityGfxDeviceW  >>> com.kmdeveloper.clone <<<
2023/10/16 21:25:37.123 29942 30017 Error CRASH uid: 10110
2023/10/16 21:25:37.124 29942 30017 Error CRASH signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xd8
2023/10/16 21:25:37.124 29942 30017 Error CRASH Cause: null pointer dereference
2023/10/16 21:25:37.124 29942 30017 Error CRASH     r0  00000004  r1  00000004  r2  00000000  r3  00000000
2023/10/16 21:25:37.124 29942 30017 Error CRASH     r4  dfc262e4  r5  f0b8cdec  r6  dfc26394  r7  00000000
2023/10/16 21:25:37.124 29942 30017 Error CRASH     r8  dfc24040  r9  f0b8c950  r10 00000000  r11 f0b8cc5c
2023/10/16 21:25:37.124 29942 30017 Error CRASH     ip  f0b8c950  sp  b068b538  lr  cd7d353f  pc  cd87f742
2023/10/16 21:25:37.125 29942 30017 Error CRASH backtrace:
2023/10/16 21:25:37.125 29942 30017 Error CRASH       #00 pc 0017b742  /vendor/lib/egl/libGLESv2_adreno.so

and this is an image of the error logs it is from the Android log cat window this time