# Error with Win64 build: A script behaviour (probably FMODUnity.EditorParamRef?) has a different serialization layout when loading

**URL:** https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753
**Category:** Unity
**Created:** [June 7, 2019, 7:06am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753 "2019-06-07T07:06:18Z")
**Posts on this page:** 15
**Page:** 1

<div class="post-metadata">

### Author: ![studioatmazeke](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@studioatmazeke](https://qa.fmod.com/u/studioatmazeke)
#### Post date: [June 7, 2019, 7:06am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/1 "2019-06-07T07:06:18Z")

</div>

Getting this error with a Win64 development build of our game on 2.00.01. There aren’t any errors when we play in the Unity Editor, 2018.1.5f1. Any suggestions?

```
A script behaviour (probably FMODUnity.EditorParamRef?) has a different serialization layout when loading. (Read 32 bytes but expected 80 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

```

 ![Annotation%202019-06-07%20000319](https://canada1.discourse-cdn.com/flex036/uploads/fmod/original/1X/0bbba58cf6a59fb91e5019b9df0881fa805a8c4b.png)

---

<div class="post-metadata">

### Author: ![KarateKidzz](https://avatars.discourse-cdn.com/v4/letter/k/c37758/32.png) [@KarateKidzz](https://qa.fmod.com/u/KarateKidzz)
#### Post date: [June 8, 2019, 4:32pm UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/2 "2019-06-08T16:32:50Z")

</div>

My uneducated guess is the `PARAMETER_ID` struct as part of the EditorParamRef class is causing the problem. Previous versions of FMOD integrations don’t have that field.

My guess would be marking the PARAMETER\_ID struct as serializable:

```
[global::System.Serializable]
[StructLayout(LayoutKind.Sequential)]
public struct PARAMETER_ID
{
    public uint data1; /* The first half of the ID. */
    public uint data2; /* The second half of the ID. */
}

```

But I don’t know sadly. However, I’d probably stay away from 2.00.00 until it’s out of early access if this is for a serious project. Otherwise, you may be waiting for an official patch.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [June 14, 2019, 5:10am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/3 "2019-06-14T05:10:24Z")

</div>

> [@KarateKidzz](#):
>
> My guess would be marking the PARAMETER\_ID struct as serializable

Does this fix the issue?

---

<div class="post-metadata">

### Author: ![studioatmazeke](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@studioatmazeke](https://qa.fmod.com/u/studioatmazeke)
#### Post date: [June 14, 2019, 4:20pm UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/4 "2019-06-14T16:20:35Z")

</div>

Unfortunately, no, the issue still persists after marking `PARAMETER_ID` as serializable.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [June 17, 2019, 12:10am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/5 "2019-06-17T00:10:52Z")

</div>

Are you able to reproduce this in an empty project?  
I have not been able to reproduce it to be able to test it further.  
Do the logs provide any more information on the error?

---

<div class="post-metadata">

### Author: ![studioatmazeke](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@studioatmazeke](https://qa.fmod.com/u/studioatmazeke)
#### Post date: [June 17, 2019, 5:55am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/6 "2019-06-17T05:55:16Z")

</div>

This is specific to our project for some reason. We are using the Adventure Creator Unity plugin, so it could be something incompatible with that. But we weren’t getting these errors before FMOD 2.0 and we’ve stayed on the same versions of both AC and Unity. I can send the whole log over if that would help.

The errors always appear after loading a specific scene and then just loop over and over in the log after this:

```
The referenced script (Unknown) on this Behaviour is missing!
UnityEngine.Resources:LoadAll(String, Type)
AC.LevelStorage:UnloadTransformData(List`1, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:382)
AC.LevelStorage:SendDataToScene(SingleLevelData, Boolean, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:119)
AC.LevelStorage:ReturnCurrentLevelData(Boolean) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:77)
AC.SceneSettings:OnStart() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\SceneSettings.cs:129)
AC.MultiSceneChecker:Start() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\MultiSceneChecker.cs:72)

[C:\buildslave\unity\build\Runtime/Mono/MonoBehaviour.cpp line 1576] 
(Filename: D:/Repos/SpiritOfMidnight/Assets/AdventureCreator/Scripts/Save system/LevelStorage.cs Line: 382)

The referenced script on this Behaviour (Game Object '<null>') is missing!
UnityEngine.Resources:LoadAll(String, Type)
AC.LevelStorage:UnloadTransformData(List`1, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:382)
AC.LevelStorage:SendDataToScene(SingleLevelData, Boolean, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:119)
AC.LevelStorage:ReturnCurrentLevelData(Boolean) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:77)
AC.SceneSettings:OnStart() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\SceneSettings.cs:129)
AC.MultiSceneChecker:Start() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\MultiSceneChecker.cs:72)

[C:\buildslave\unity\build\Runtime/Mono/MonoBehaviour.cpp line 1789] 
(Filename: D:/Repos/SpiritOfMidnight/Assets/AdventureCreator/Scripts/Save system/LevelStorage.cs Line: 382)

A script behaviour (script unknown or not yet loaded) has a different serialization layout when loading. (Read 48 bytes but expected 896 bytes)
Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?
UnityEngine.Resources:LoadAll(String, Type)
AC.LevelStorage:UnloadTransformData(List`1, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:382)
AC.LevelStorage:SendDataToScene(SingleLevelData, Boolean, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:119)
AC.LevelStorage:ReturnCurrentLevelData(Boolean) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:77)
AC.SceneSettings:OnStart() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\SceneSettings.cs:129)
AC.MultiSceneChecker:Start() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\MultiSceneChecker.cs:72)

[C:\buildslave\unity\build\Runtime/Serialize/SerializedFile.cpp line 1967] 
(Filename: D:/Repos/SpiritOfMidnight/Assets/AdventureCreator/Scripts/Save system/LevelStorage.cs Line: 382)

The referenced script (FMODUnity.EditorBankRef) on this Behaviour is missing!
UnityEngine.Resources:LoadAll(String, Type)
AC.LevelStorage:UnloadTransformData(List`1, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:382)
AC.LevelStorage:SendDataToScene(SingleLevelData, Boolean, SubScene) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:119)
AC.LevelStorage:ReturnCurrentLevelData(Boolean) (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Save system\LevelStorage.cs:77)
AC.SceneSettings:OnStart() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\SceneSettings.cs:129)
AC.MultiSceneChecker:Start() (at D:\Repos\SpiritOfMidnight\Assets\AdventureCreator\Scripts\Game engine\MultiSceneChecker.cs:72)
```

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [June 17, 2019, 11:17pm UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/7 "2019-06-17T23:17:06Z")

</div>

If you would like to send the entire log file to [support@fmod.com](mailto:support@fmod.com), I can take a look.

Although it looks like `UnityEngine.Resources:LoadAll` is trying to load the FMOD Editor files, they don’t get included in built games (like all other Editor files).

---

<div class="post-metadata">

### Author: ![studioatmazeke](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@studioatmazeke](https://qa.fmod.com/u/studioatmazeke)
#### Post date: [June 18, 2019, 1:38am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/8 "2019-06-18T01:38:12Z")

</div>

Sent the log so you can check it out in full.

If it does end up being the `UnityEngine.Resources:LoadAll` call, is that an issue that only the Adventure Creator folks can fix? Or is this a Unity issue? I was under the assumption that Unity handled files in Editor folders gracefully.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [June 18, 2019, 3:40am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/9 "2019-06-18T03:40:09Z")

</div>

Unity does strip out all Editor files when building a game, this is also why you are getting:

> The referenced script (FMODUnity.EditorBankRef) on this Behaviour is missing!

I don’t know how the Adventure Creator is populating a list of resources to load but it seems to be including the EditorBankRef, which is used for displaying bank information in the Editor inspector (Eg. StudioBankLoader script).

You will need to contact the creators of the Adventure Creator plugin.

---

<div class="post-metadata">

### Author: ![studioatmazeke](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@studioatmazeke](https://qa.fmod.com/u/studioatmazeke)
#### Post date: [June 18, 2019, 4:27am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/10 "2019-06-18T04:27:51Z")

</div>

Gotcha, will do - thanks a bunch for your help!

---

<div class="post-metadata">

### Author: ![studioatmazeke](https://avatars.discourse-cdn.com/v4/letter/s/2bfe46/32.png) [@studioatmazeke](https://qa.fmod.com/u/studioatmazeke)
#### Post date: [June 19, 2019, 2:41am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/11 "2019-06-19T02:41:34Z")

</div>

Just in case anyone happens to drop in here with a similar issue, this is a link to the continuation on Adventure Creator’s forums: [https://www.adventurecreator.org/forum/discussion/8900/ac-trying-to-load-editor-specific-fmod-classes-resulting-in-build-errors](https://www.adventurecreator.org/forum/discussion/8900/ac-trying-to-load-editor-specific-fmod-classes-resulting-in-build-errors)

---

<div class="post-metadata">

### Author: ![Ryxali](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@Ryxali](https://qa.fmod.com/u/Ryxali)
#### Post date: [October 14, 2019, 12:30pm UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/12 "2019-10-14T12:30:25Z")

</div>

Haven’t checked if this has been fixed in a future update, but this is caused by FMODStudioCache.asset lying in a Resources folder and some other code running a Resources.LoadAll() without any path specification. Unity tries deserializing an editor-only asset and fails, displaying the error message.

The simple solution is to move the FMODStudioCache.asset to another folder, as it shouldn’t be in Resources to begin with. I changed the path EventManager.CacheAssetFullName to another folder and made sure it existed in my project, then deleted the old cache and let it regenerate.

> [@cameron-fmod](#):
>
> Unity does strip out all Editor files when building a game

It does, but the FMODStudioCache.asset isn’t an editor file. Is there a particular reason it’s in a Resources folder? Just want to avoid having shot myself in the foot if a planned feature comes around and breaks our fmod because I moved it. ^^

---

<div class="post-metadata">

### Author: ![rhys\_vdw](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/rhys_vdw/32/2454_2.png) [@rhys\_vdw](https://qa.fmod.com/u/rhys_vdw)
#### Post date: [October 23, 2019, 5:15am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/13 "2019-10-23T05:15:14Z")

</div>

I’ve just hit this problem as well. This is an incompatibility with the Unity API as it supports loading resoureces by type like so:

```
var configs = Resources.LoadAll("", typeof(MapLoadConfig));

```

> [@cameron-fmod](#):
>
> Although it looks like `UnityEngine.Resources:LoadAll` is trying to load the FMOD Editor files, they don’t get included in built games (like all other Editor files).

AFAIK _all_ files in Resources folder are included in the build. If you want to access the assets in the editor you should be using AssetDatabase API, not Resources.

---

<div class="post-metadata">

### Author: ![rhys\_vdw](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/rhys_vdw/32/2454_2.png) [@rhys\_vdw](https://qa.fmod.com/u/rhys_vdw)
#### Post date: [October 23, 2019, 5:22am UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/14 "2019-10-23T05:22:17Z")

</div>

[Seems I was mistaken](https://answers.unity.com/questions/1245174/files-put-inside-a-resources-folder-still-dont-end.html#). Nonetheless I’d like a better solution that “avoid loading resources by type” if possible.

---

<div class="post-metadata">

### Author: ![cameron-fmod](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/cameron-fmod/32/261_2.png) [@cameron-fmod](https://qa.fmod.com/u/cameron-fmod)
#### Post date: [October 29, 2019, 10:26pm UTC](https://qa.fmod.com/t/error-with-win64-build-a-script-behaviour-probably-fmodunity-editorparamref-has-a-different-serialization-layout-when-loading/14753/15 "2019-10-29T22:26:34Z")

</div>

We have a task to move the files out of the resources folder to avoid this issue. It is currently scheduled for the release at the start of December.
