How to correctly create a standalone build?

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
Post Reply
User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

How to correctly create a standalone build?

Post by Nystul »

I am having problems creating a working standalone build.
When starting the created executable It looks like this:
Image

excerpts from the output_log file:

Unable to find shaders used for the terrain engine. Please include Nature/Terrain/Diffuse shader in Graphics settings.

NullReferenceException
at (wrapper managed-to-native) UnityEngine.Material:Internal_CreateWithShader (UnityEngine.Material,UnityEngine.Shader)
at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.DaggerfallTerrain.InstantiateTerrain () [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.StreamingWorld.UpdateTerrainData (TerrainDesc terrainDesc) [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.StreamingWorld.InitPlayerTerrain () [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.StreamingWorld.Update () [0x00000] in <filename unknown>:0

I manually added shader Nature/Terrain/Diffuse in the Project Settings->Graphics section. I don't understand why I still get the message from above...

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: How to correctly create a standalone build?

Post by Interkarma »

Try adding "Nature/Terrain/Standard". From memory this fixed it for me when I last created a Unity5 + DFTFU1.3 build. Let me know how you go.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: How to correctly create a standalone build?

Post by Nystul »

it eliminates the log message, but the output is still the same
in the output_log it is complaining a lot about NullReferenceException both coming from StreamingWorld as well as from IncreasedTerrainDistance...

tried to do only the scene without IncreasedTerrainDistance script, so the only remaining output_log error messages are:

NullReferenceException
at (wrapper managed-to-native) UnityEngine.Material:Internal_CreateWithShader (UnityEngine.Material,UnityEngine.Shader)
at UnityEngine.Material..ctor (UnityEngine.Shader shader) [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.DaggerfallTerrain.InstantiateTerrain () [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.StreamingWorld.UpdateTerrainData (TerrainDesc terrainDesc) [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.StreamingWorld.InitPlayerTerrain () [0x00000] in <filename unknown>:0
at DaggerfallWorkshop.StreamingWorld.Update () [0x00000] in <filename unknown>:0

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: How to correctly create a standalone build?

Post by Interkarma »

Here's a rundown of how I create standalone builds.

1. Add all required shaders to Edit > Projects Settings > Graphics > Always included shaders. These are:
  • Daggerfall/Billboard Batch
  • Daggerfall/Tilemap
  • Nature/Terrain/Standard
  • Plus Any other custom shaders required outside of DFTFU.
2. Clear your DaggerfallUnity Arena2 path using the Clear button in its Inspector. Save scene & project.

3. Use Ctrl+Shift+B to open build window. Click Project Settings and configure project name, render path, icon, etc.

4. Add current scene to build list.

5. Switch to target platform (e.g. Windows x86) and click Build. Select output path. Note: Creating Web & WebGL builds are a bit more advanced and best ignored until I finish writing up the tutorial for you guys.

6. Once build completed, copy Daggerfall's arena2 folder into the ApplicationName_Data folder created in your build path. DFTFU will automatically look in the Data folder for a valid arena2 path.

If you still have problems, zip up the entire project (don't just create a package) and put it somewhere I can grab it. I'm happy to take a look and help diagnose. :)

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: How to correctly create a standalone build?

Post by Nystul »

ah thanks, i was definitely missing the billboardbatch and tilemap shaders

i no longer get the null reference error

I still have not succeeded completely though
current error is:

Texture is not accessible.
(Filename: Line: 330)

update:
it is working now and I don't know what made it work :D

The RealGrass mod is not showing the grass texture - where do i have to put it inside the folder structure to get it working?

User avatar
Interkarma
Posts: 7247
Joined: Sun Mar 22, 2015 1:51 am

Re: How to correctly create a standalone build?

Post by Interkarma »

For those sorts of loose assets, create a folder in your project called Resources and drop the texture into that. You can have several Resources folders and they all get packed together into the final build.

DFTFU can also load raw arena2 files out of Resources (FileProxy supports memory/disk/Resources), but it's a bit slower and involves more prep than the method I use above. Great for WebPlayer and tablet builds though. I'll cover that in more detail when I finally get to that tutorial.

User avatar
Nystul
Posts: 1501
Joined: Mon Mar 23, 2015 8:31 am

Re: How to correctly create a standalone build?

Post by Nystul »

I managed to get everything to work except the RealGrass mod.
The texture is still missing, I tried putting it basically everywhere (in different Resource subfolder - and of course established the texture connection to this new location) :)
any idea why it won't load correctly? I see pixel-randomness bend in the wind :D

Post Reply