Jump to content

Building my game removes all the object spawns


NaishTech
 Share

Go to solution Solved by NaishTech,

Recommended Posts

Hi when I build my game all the objects under "Gaia Game Object Spawns" which is a child of "Gaia Tools" is not included.

Works fine when playing in the editor.

What am I doing wrong?

Thanks

 

 

Link to comment
Share on other sites

Thanks, I'm using Gaia (3.2.3-c5, Unity 2021.3.2f1)

Pretty much the default configuration (Desktop) with my own custom Biome.

Building windows 64 bit.

Link to comment
Share on other sites

So one thing that is interesting is why the Gaia Game Object Spawns are under the Gaia Tools. 
Typically they should be under the Terrain. Which the parent object should be Gaia Terrains. 
Was this moved for any reason? 

It wouldn't show up under Gaia Tools due to the tag being Editor Only. 
 

Link to comment
Share on other sites

Hey thanks for the reply.

Sorry I should have mentioned that I did change the spawn target for each of my spawners.

I did this because I have a custom nav mesh agent that treats the terrain (and everything under it) as navigable. If trees are a child of terrain, well you see the problem.

So I figured if, under Spawn Rules, for each rule, if I set Spawner Target Mode to "Single Transform" and set the transform to be a parent GameObject in the root of the scene, then all the objects would spawn there instead.

But when I do that, Gaia seems to delete (or move) the root GameObject and put it under "Gaia Game Object Spawns" instead (which is a child of "Gaia Tools").

Hope this makes sense.

 

 

Link to comment
Share on other sites

On 6/25/2022 at 8:10 PM, NaishTech said:

Hey thanks for the reply.

Sorry I should have mentioned that I did change the spawn target for each of my spawners.

I did this because I have a custom nav mesh agent that treats the terrain (and everything under it) as navigable. If trees are a child of terrain, well you see the problem.

So I figured if, under Spawn Rules, for each rule, if I set Spawner Target Mode to "Single Transform" and set the transform to be a parent GameObject in the root of the scene, then all the objects would spawn there instead.

But when I do that, Gaia seems to delete (or move) the root GameObject and put it under "Gaia Game Object Spawns" instead (which is a child of "Gaia Tools").

Hope this makes sense.

 

 

I have been able to replicate this I will send it to the team! 
 

Link to comment
Share on other sites

  • Solution
On 6/28/2022 at 1:29 PM, Bryan said:

I have been able to replicate this I will send it to the team! 
 

Thanks.

 

For those interested in a work around, I have created the following script that will intervene in builds and scene openings to unparent and reparent the object spawns respectively.

 

using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;

[InitializeOnLoad]
public class GaiaObjectVisibility : IPreprocessBuildWithReport
{
    public int callbackOrder => 0;

    static GaiaObjectVisibility()
    {
        if (!EditorApplication.isCompiling)
        {
            EditorSceneManager.sceneOpened += EditorSceneManager_sceneOpened;
        }
    }

    private static void EditorSceneManager_sceneOpened(Scene scene, OpenSceneMode mode)
    {
        if (BuildPipeline.isBuildingPlayer) { return; }

        GameObject objectSpawns = GameObject.Find("Gaia Game Object Spawns");

        if (objectSpawns == null) { return; }

        if (objectSpawns.transform.parent != null) { return; }

        objectSpawns.transform.parent = GameObject.Find("Gaia Tools").transform;

        EditorSceneManager.SaveScene(scene);
    }

    public void OnPreprocessBuild(BuildReport report)
    {

        EditorSceneManager.sceneOpened += EditorSceneManager_preProcessSceneOpened;

        UnparentGaiaObjectSpawns();
    }

    public static void EditorSceneManager_preProcessSceneOpened(Scene scene, OpenSceneMode mode)
    {
        UnparentGaiaObjectSpawns();
    }

    public static void UnparentGaiaObjectSpawns()
    {

        GameObject objectSpawns = GameObject.Find("Gaia Game Object Spawns");

        if (objectSpawns == null) { return; }

        objectSpawns.transform.parent = null;

        Scene scene = SceneManager.GetActiveScene();
        EditorSceneManager.SaveScene(scene);

    }


}

 

  • Like 1
Link to comment
Share on other sites

Hi @NaishTech,

thanks for posting your solution to this issue! We reviewed the core cause of the objects disappearing, namely:

 

On 6/26/2022 at 4:10 AM, NaishTech said:

But when I do that, Gaia seems to delete (or move) the root GameObject and put it under "Gaia Game Object Spawns" instead (which is a child of "Gaia Tools").

This was a bug in Gaia where it would clean up previous spawns before spawning again, and deleting the custom transform in that turn. This has been fixed in the latest Gaia update, it should now leave that transform in peace and spawn the objects underneath.

  • Like 2
Link to comment
Share on other sites

  • Bryan locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...