Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity - A scripted object has a different serialization layout when loading error

The game has run on my iPhone 8 Plus before, and it has worked with no issues up until now. Now I get the following output in Xcode during the app's runtime:

2019-03-25 02:16:01.659981+0000 tester[5780:2725434] [DYMTLInitPlatform] platform initialization successful
CrashReporter: initialized
2019-03-25 02:16:01.731073+0000 tester[5780:2725204] Built from '2018.3/staging' branch, Version '2018.3.3f1 (393bae82dbb8)', Build type 'Release', Scripting Backend 'il2cpp'
2019-03-25 02:16:01.734912+0000 tester[5780:2725204] -> registered mono modules 0x101706230
-> applicationDidFinishLaunching()
2019-03-25 02:16:01.876713+0000 tester[5780:2725204] Metal GPU Frame Capture Enabled
2019-03-25 02:16:01.877790+0000 tester[5780:2725204] Metal API Validation Disabled
2019-03-25 02:16:02.125502+0000 tester[5780:2725204] [Warning] Trying to set delaysTouchesBegan to NO on a system gate gesture recognizer - this is unsupported and will have undesired side effects
-> applicationDidBecomeActive()
GfxDevice: creating device client; threaded=1
Initializing Metal device caps: Apple A10 GPU
Initialize engine version: 2018.3.3f1 (393bae82dbb8)
2019-03-25 02:16:02.722439+0000 tester[5780:2725483] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
2019-03-25 02:16:02.723162+0000 tester[5780:2725483] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
CrashReporter: No pending report exists at /var/mobile/Containers/Data/Application/2F1B8739-D2F2-4116-92CA-BAE215C4DD5D/Library/Caches/CrashReports/crash-pending.plcrashThe referenced script (Network) on this Behaviour is missing!

(Filename:  Line: 195)

The referenced script (ClientHandleData) on this Behaviour is missing!

(Filename:  Line: 195)

The referenced script (ClientSendData) on this Behaviour is missing!

(Filename:  Line: 195)

The referenced script (Player) on this Behaviour is missing!

(Filename:  Line: 195)

The referenced script (MenuManager2) on this Behaviour is missing!

(Filename:  Line: 195)

The referenced script (GPS) on this Behaviour is missing!

(Filename:  Line: 195)

The referenced script on this Behaviour (Game Object 'NetworkManager') is missing!

(Filename:  Line: 294)

A scripted object (probably Network?) has a different serialization layout when loading. (Read 32 bytes but expected 60 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

(Filename:  Line: 2001)

The referenced script on this Behaviour (Game Object 'NetworkManager') is missing!

(Filename:  Line: 294)

A scripted object (probably Player?) has a different serialization layout when loading. (Read 32 bytes but expected 52 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

(Filename:  Line: 2001)

The referenced script on this Behaviour (Game Object 'NetworkManager') is missing!

(Filename:  Line: 294)

A scripted object (probably ClientSendData?) has a different serialization layout when loading. (Read 32 bytes but expected 44 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

(Filename:  Line: 2001)

The referenced script on this Behaviour (Game Object 'NetworkManager') is missing!

(Filename:  Line: 294)

The referenced script on this Behaviour (Game Object 'MenuManager') is missing!

(Filename:  Line: 294)

A scripted object (probably MenuManager2?) has a different serialization layout when loading. (Read 32 bytes but expected 68 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

(Filename:  Line: 2001)

The referenced script on this Behaviour (Game Object 'GPS') is missing!

(Filename:  Line: 294)

A scripted object (probably GPS?) has a different serialization layout when loading. (Read 32 bytes but expected 36 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

(Filename:  Line: 2001)

UnloadTime: 2.920625 ms
Setting up 1 worker threads for Enlighten.
  Thread -> id: 170b7b000 -> priority: 1

I have not used #ifdef UNITY_EDITOR anywhere in my code. The game runs perfectly fine in the Unity editor with no issues or warnings. The game does load onto the phone showing the main menu, but the play button does not progress to the next scene.

Seems to be consistently reading only 32 bytes for each object based on the output.

Any ideas?

like image 349
PAVAN007 Avatar asked Mar 22 '26 12:03

PAVAN007


1 Answers

I ran into this issue recently. In my case, I had to convert a Windows game to support Mac. The game worked perfectly in the Editor but not when it was standalone.

This is because I forgot to update the includePlatforms in asmdef to include the platform that I was building, i.e. macOSStandalone. (It worked in Editor because I specified "Editor" in "includePlatforms")

Weirdly, I didn't find any Unity docs on what other possible choices are. I found a large list of them here: Unity Multiple Assembly Definition Files Error

like image 152
James Miao Avatar answered Mar 25 '26 02:03

James Miao



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!