Jump to content

GeNa runtime spawns succeed in editor, fail in build


FoxTheDog
 Share

Go to solution Solved by Manny,

Recommended Posts

Unity v. 2021.1

Gaia Pro v3.1.4

GeNa Pro v.3.3.15

 

Behavior

Runtime spawns do not execute in the build, but do just fine in the editor. Digging through the dev build log files, I found the following error related to GeNa spawning:

 

--------------------------------------------------

ArgumentNullException: Value cannot be null.
Parameter name: shader
  at GeNa.Core.TerrainTools.get_GreyScaleMat () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.TerrainTools.GenerateTerrainEntity (GeNa.Core.TerrainModifier terrainModifier) [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaTerrainDecorator+<OnSelfSpawned>d__10.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal+OAHPPOMFKDM.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal+OAHPPOMFKDM.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal+OAHPPOMFKDM.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal+OAHPPOMFKDM.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal+POBBOINMJAC.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal+ALDOPFKMHPM.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal.Spawn (GeNa.Core.GeNaSpawner geNaSpawner, UnityEngine.Transform target, UnityEngine.Transform ground, UnityEngine.Vector3 position) [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawnerInternal.Spawn (GeNa.Core.GeNaSpawner geNaSpawner, UnityEngine.Vector3 position) [0x00000] in <00000000000000000000000000000000>:0 
  at GeNa.Core.GeNaSpawner.Spawn (UnityEngine.Vector3 position) [0x00000] in <00000000000000000000000000000000>:0 
  at rogueMech.RuntimeExecutor.Start () [0x00000] in <00000000000000000000000000000000>:0 

--------------------------------------------------

 

*edited to focus on the shader error*

Edited by FoxTheDog
Link to comment
Share on other sites

Unity v. 2021.1 - URP

Gaia Pro v3.1.4

GeNa Pro v.3.3.15

 

The project I've been building is pretty complex (for me) and probably has a bunch of other issues that make troubleshooting difficult. I iterated over disabling specific runtime spawners that execute in a loop in RuntimeExecutor.Start(), and found the issue to be the spawner that was allocating structures across the terrain. These are bigger structures with subspawners etc, so I created a new project to test the issue.

Behavior:

GeNa spawners with terrain decorators succeed in editor, but fail in builds.

Steps to reproduce:

1) New project, create a default Gaia terrain with Alpine Meadow defaults.

2) Create a prefab with a simple cube, add a terrain decorator with any brush

3) Create a GeNa spawner for the cube

4) Create a runtime spawning script for the GeNa cube spawner to place *more than one* cube at runtime

5) Hit play in the editor, notice spawning succeeds. 

6) Exit play mode. Additionally, note the terrain modifications persist, see my other topic: 

 

7) Create a devbuild and run - view the error posted above in the log, with no (sometimes one) cubes spawning.

Link to comment
Share on other sites

  • Solution

Hey @FoxTheDog,

Thank you so much for going through all the effort to provide us with details on how to replicate the issue. 
I believe I know what's causing this particular issue. I've noticed that certain shaders we want to not be included in builds actually need to be included or else issues like this occur. I'm currently going through the entire project and ensuring that this is the case (there are a tonne of files).

In the mean time, I think I may have a work around, could you try moving the "PW_GrayScale" shader file located under Procedural Worlds > GeNa > Shaders into the "Resources" folder located in Procedural Worlds > GeNa > Resources:
image.png

This should force that shader to be included in the build so that GeNa can find it.

Let me know if this works for you! 😁

Link to comment
Share on other sites

Thanks @Manny for the response!  Your workaround did the trick -- now prefabs with terrain decorators are spawning at runtime successfully. Huge thanks, I feel silly for not knowing this was the issue, but I really appreciate workaround.

I had to track down some additional runtime errors that were only present in the build, and not in the editor. Specifically, these errors did not appear if I was not using GeNa spawners with terrain decorators at runtime in a build for my environment. 

Some meshes, I think it has to do with the shaders I built, required the parent object to be read/write enabled

mesh_not_rw.thumb.JPG.adecd1b565647e02128ae382484e1a2d.JPG

For folks interested in how to fix this, navigate to your mesh and enable 'read write enabled.  rw_on_mesh.JPG.5e21bf33607299ce62e9858263b6b54b.JPG

 

Id be curious to know if this is a big deal or not.

Link to comment
Share on other sites

2 minutes ago, FoxTheDog said:

Thanks @Manny for the response!  Your workaround did the trick -- now prefabs with terrain decorators are spawning at runtime successfully. Huge thanks, I feel silly for not knowing this was the issue, but I really appreciate workaround.

I had to track down some additional runtime errors that were only present in the build, and not in the editor. Specifically, these errors did not appear if I was not using GeNa spawners with terrain decorators at runtime in a build for my environment. 

Some meshes, I think it has to do with the shaders I built, required the parent object to be read/write enabled

mesh_not_rw.thumb.JPG.adecd1b565647e02128ae382484e1a2d.JPG

For folks interested in how to fix this, navigate to your mesh and enable 'read write enabled.  rw_on_mesh.JPG.5e21bf33607299ce62e9858263b6b54b.JPG

 

Id be curious to know if this is a big deal or not.

Not a problem! And huge thanks for providing a heap of info on this!

 

We're always looking to improve GeNa and our other tools so any help is always appreciated! 😁

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Tell a friend

    Love Unity 3D World & Game Creation Tools - Canopy - Procedural Worlds? Tell a friend!
  • Interesting Articles

    1. 42

      GeNa Pro City Generator

    2. 1

      World Creator + Gaia

    3. 1

      Gena decorator??

    4. 1

      Objects spawning at unexpected position in segmented scene.

    5. 1

      GeNa pro shows error while loading.

×
×
  • Create New...