Jump to content

Issues creating custom player and tying it to Flora


Moddingdudes
Go to solution Solved by Peter,

Recommended Posts

I am using Flora and Gaia Pro 2021.

I was trying to make my own character. I dynamically am adding the Terrain Loader script and floating point error script, however I did not add the Gaia scene player script since it seemed to have terrain loading settings twice which confused me. As well, I couldn't dynamically add the camera and player object during runtime since it's dynamically made by my network framework (Mirror) when I load into the game scene.

I set the Gaia Global camera to my player active skin camera, but that still leaves me with an error claiming the underwater effects couldn't find it, and it filled it anyways.

As well, since my player is dynamically created, Flora can't seem to make out what the scene camera (culling camera) should be. So right now I have it set up so when a new scene is loaded (I put my own callback into Gaia code in the TerrainScene.SceneLoadCompletedRegular function, called OnTerrainSceneRegularLoaded in my GameManager. Same for imposter), I scan for all loaded terrains that are using Flora, and manually set the DetailCamera property to my active skin camera.

So my 3 few issues/questions are:

1. Why is there a terrain loader twice in Flying Free cam? (Once in the base player and once on the flying cam)?

2. How can I set up Gaia using a dynamically instantiated player?

3. How can I get Flora to work with my dynamically instantiated player?

Link to comment
Share on other sites

You will need to use the Gaia Custom Player. 
In the runtime - player- Gaia Custom Player. 

Then Flora and Gaia systems should work. 
Just make sure that you tag the player as player and camera as main camera. 
If you are using multiple camera you will need to tag one as the main and make a script that ties into the Gaia Player to switch them. 

 

1 hour ago, Moddingdudes said:

1. Why is there a terrain loader twice in Flying Free cam? (Once in the base player and once on the flying cam)?

Correct

 

1 hour ago, Moddingdudes said:

2. How can I set up Gaia using a dynamically instantiated player?

Explained above

 

1 hour ago, Moddingdudes said:

3. How can I get Flora to work with my dynamically instantiated player?

By using the Gaia Custom Player. 
Also make sure that you tag Flora Terrain Tile Source Camera: 
image.png

This is in the terrain inspector. 

 

Link to comment
Share on other sites

I tried, but unfortunately I'm still getting errors.

I set it up so when my skin is instantiated, it tags the camera as MainCamera, and my player is already tagged Player before runtime.

Could you please give me an idea of how to use the Gaia Custom Player/Gaia Scene Player to do this via script as after I load the scene? I need to fill the Main Camera and I would also be curious as to how you fill out the Main Player fields.

When I tried myself, I took a reference to the Gaia Scene Player and couldn't find any sort of class API to work with besides m_gaiaCreatedControllers and m_gaiaUI?

How do I apply the setup to the scene character during runtime so it can work with the rest of Gaia?

Thanks!

Link to comment
Share on other sites

What you can do is try to leave the slots blank. 
Then Gaia would pick up the player and camera automatically. 

As far as the API is concerned I will look into this for you! 

 

Link to comment
Share on other sites

I tried to leave the slots blank, Gaia doesn't automatically find it. Does it matter exactly when the player is loaded? Does it have to be before Gaia Runtime Start for example? Gaia Global found the camera, but the Gaia Scene Player did not find the player object nor the player camera object, and due to that the terrains are not loading around the player.

Also, when we figure this out, I can finally answer this ticket

I just updated the unity editor but since the build doesn't work right, I can't yet test to confirm if updating it fixed it.

What else should I do to fix the Gaia Scene Player during runtime?

Thanks 🙂

Link to comment
Share on other sites

  • Solution

Hi @Moddingdudes, can you please try to call the static function GaiaAPI.SetRuntimePlayerAndCamera to set the Player Game Object and Camera after you spawned / created them in your code?

Link to comment
Share on other sites

14 hours ago, Peter said:

Hi @Moddingdudes, can you please try to call the static function GaiaAPI.SetRuntimePlayerAndCamera to set the Player Game Object and Camera after you spawned / created them in your code?

Unfortunately, this didn't work for me. I got an error:

Player Camera is missing from the setup. Will try find it for you
UnityEngine.Debug:LogError (object)
Gaia.GaiaUnderwaterEffects:Update () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/GaiaUnderwaterEffects.cs:346)

Which seems to be related to underwater effects. I also didn't see any difference for the editor on the Gaia Scene Player, still saying "You are missing either the Controller gameobject or the Camera component. Please assign them. Once you've assigned them you will be able to press 'Apply Setup'".

Looking into the API code, I see it does rely on the GaiaSessionManager. I do have multiple sessions in Assets/Gaia User Data/Sessions. Will this have an effect?

Any ideas of what it could be? I for sure thought that would be it 😄

Thanks!

Link to comment
Share on other sites

 

24 minutes ago, Moddingdudes said:

Unfortunately, this didn't work for me. I got an error:

Player Camera is missing from the setup. Will try find it for you
UnityEngine.Debug:LogError (object)
Gaia.GaiaUnderwaterEffects:Update () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/GaiaUnderwaterEffects.cs:346)
 

Which seems to be related to underwater effects. I also didn't see any difference for the editor on the Gaia Scene Player, still saying "You are missing either the Controller gameobject or the Camera component. Please assign them. Once you've assigned them you will be able to press 'Apply Setup'".

Looking into the API code, I see it does rely on the GaiaSessionManager. I do have multiple sessions in Assets/Gaia User Data/Sessions. Will this have an effect?

Any ideas of what it could be? I for sure thought that would be it 😄

Thanks!

Whoops! Looked it over and my callback mechanism failed so I wasn't actually calling your function. Still get the error but it's because I call it while the underwater handler instance is null but I'm not worried about it.

Works great! Thanks! 🙂

 

Link to comment
Share on other sites

  • Bryan locked this topic
Guest
This topic is now closed to further replies.
  • 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...