Build different from editor version

Hey guys,

i have a problem: When i start playing my game in the editor everything works fine just as it should! Now i build a windows version of my game and a part stopped working: The explosions dont work (I use the free detonator package available in the store!). Just as i said the editor version works fine its only when i play the windows build. Thats what the error log file says:

Initialize engine version: 4.3.3f1 (c8ca9b6b9936)
GfxDevice: creating device client; threaded=1
Direct3D:
Version: Direct3D 9.0c [aticfx32.dll 8.17.10.1247]
Renderer: AMD Radeon HD 7700 Series
Vendor: ATI
VRAM: 1010 MB (via DXGI)
Caps: Shader=30 DepthRT=1 NativeDepth=1 NativeShadow=1 DF16=1 INTZ=1 RAWZ=0 NULL=1 RESZ=1 SlowINTZ=1
Begin MonoManager ReloadAssembly
Platform assembly: C:\Users\Jonas\Desktop\Drunken Drive_Data\Managed\UnityEngine.dll (this message is harmless)
Loading C:\Users\Jonas\Desktop\Drunken Drive_Data\Managed\UnityEngine.dll into Unity Child Domain
Platform assembly: C:\Users\Jonas\Desktop\Drunken Drive_Data\Managed\Assembly-CSharp.dll (this message is harmless)
Loading C:\Users\Jonas\Desktop\Drunken Drive_Data\Managed\Assembly-CSharp.dll into Unity Child Domain
Platform assembly: C:\Users\Jonas\Desktop\Drunken Drive_Data\Managed\Assembly-UnityScript.dll (this message is harmless)
Loading C:\Users\Jonas\Desktop\Drunken Drive_Data\Managed\Assembly-UnityScript.dll into Unity Child Domain

  • Completed reload, in 0.084 seconds
    Initializing input.

Input initialized.

desktop: 1920x1080 60Hz; virtual: 1920x1080 at 0,0
NullReferenceException
at (wrapper managed-to-native) UnityEngine.Material:Internal_CreateWithShader (UnityEngine.Material,UnityEngine.Shader)

at UnityEngine.Material…ctor (UnityEngine.Shader shader) [0x00000] in :0

at Detonator.DefaultFireballAMaterial () [0x00000] in :0

at Detonator.FillDefaultMaterials () [0x00000] in :0

at Detonator.Awake () [0x00000] in :0
UnityEngine.Object:INTERNAL_CALL_Internal_InstantiateSingle(Object, Vector3&, Quaternion&)
UnityEngine.Object:Internal_InstantiateSingle(Object, Vector3, Quaternion)
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
player:OnCollisionEnter(Collision)

(Filename: Line: -1)

Verloren

(Filename: C:/BuildAgent/work/d3d49558e4d408f4/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 53)

Platform assembly: C:\Users\Jonas\Desktop\Drunken Drive_Data\Managed\Boo.Lang.dll (this message is harmless)
NullReferenceException
at (wrapper managed-to-native) UnityEngine.Material:Internal_CreateWithShader (UnityEngine.Material,UnityEngine.Shader)

at UnityEngine.Material…ctor (UnityEngine.Shader shader) [0x00000] in :0

at Detonator.DefaultFireballAMaterial () [0x00000] in :0

at Detonator.FillDefaultMaterials () [0x00000] in :0

at Detonator.Awake () [0x00000] in :0
UnityEngine.Object:INTERNAL_CALL_Internal_InstantiateSingle(Object, Vector3&, Quaternion&)
UnityEngine.Object:Internal_InstantiateSingle(Object, Vector3, Quaternion)
UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)
player:OnCollisionEnter(Collision)

(Filename: Line: -1)

Verloren

(Filename: C:/BuildAgent/work/d3d49558e4d408f4/artifacts/StandalonePlayerGenerated/UnityEngineDebug.cpp Line: 53)

It looks like the problem is when Detonator.Awake tries to create the DefaultFireballAMaterial. My guess is that the problem is that Unity strips out unreferenced assets when it does executable builds. Probably the code in FillDefaultMaterials references a material that is only referenced by code, and so it gets removed on export. If you put that file in your Resources folder or if you add a reference to it from a live game object, that should fix it.