Jump to content

Custom Player at Runtime


Ishmhora

Recommended Posts

I am attempting to find away to assign a custom camera and player to the GAIA Scene Player scripts at runtime.  I'm working in a multiscene workflow so my player is outside of the scene where the gaia runtime objects are located.  I have attempted to leverage the GaiaAPI.SetRuntimePlayerAndCamera but I'm not finding success.  I would like to use the GAIA runtime features but I need to be able to operate on multiple scenes to scale the project.  I'm certain there is something that I'm missing but I haven't found any documentation or threads in the forums so far that have got me to a solution.

Link to comment
Share on other sites

If you are using the Gaia custom player, and then you are assign the player the player and camera to player and main camera it will auto assign on runtime. 

You dont need to set it if the tags are there. 

 

Link to comment
Share on other sites

So I can't set the player and camera for a cross scene reference on the variable via the editor.  I need a mechanism in code that will assign those variables so that I can load in the scene and connect it to the player that is in a different scene.  It looked like I should be able to do that using an API but I didn't manage to get that working and couldn't find documentation to help clarify if there's a namespace or something that I need to implement somewhere.

Link to comment
Share on other sites

Not exactly. 

By leaving the components blank on the Gaia Custom Player. As long as they are tagged correctly, when the player and camera enters the scene Gaia should automatically pick them up. 

 

Link to comment
Share on other sites

  • 2 weeks later...
On 10/31/2022 at 3:03 PM, Bryan said:

Not exactly. 

By leaving the components blank on the Gaia Custom Player. As long as they are tagged correctly, when the player and camera enters the scene Gaia should automatically pick them up. 

 

This doesn't appear to be the case for me. I have a player object (and camera) that spawns in the scene (via NeoFPS). You said "as long as they are tagged correctly" so I'm assuming you mean tagged with "MainCamera" and "Player" tags. They are, and Gaia isn't picking them up.

 

I have the global settings set to custom, but can't assign either the main player or camera since they're prefabs (and the camera is embedded in the player prefab).

 

How do you assign these at runtime?

Link to comment
Share on other sites

On 10/23/2022 at 9:53 PM, Ishmhora said:

I am attempting to find away to assign a custom camera and player to the GAIA Scene Player scripts at runtime.  I'm working in a multiscene workflow so my player is outside of the scene where the gaia runtime objects are located.  I have attempted to leverage the GaiaAPI.SetRuntimePlayerAndCamera but I'm not finding success.  I would like to use the GAIA runtime features but I need to be able to operate on multiple scenes to scale the project.  I'm certain there is something that I'm missing but I haven't found any documentation or threads in the forums so far that have got me to a solution.

 

On 11/12/2022 at 2:09 PM, Bil Simser said:

This doesn't appear to be the case for me. I have a player object (and camera) that spawns in the scene (via NeoFPS). You said "as long as they are tagged correctly" so I'm assuming you mean tagged with "MainCamera" and "Player" tags. They are, and Gaia isn't picking them up.

 

I have the global settings set to custom, but can't assign either the main player or camera since they're prefabs (and the camera is embedded in the player prefab).

 

How do you assign these at runtime?



The solution is this. 

You would want to use the Gaia API if you are loading in the player after the scene is started called: 

GaiaAPI.SetRuntimePlayerAndCamera

Then set the player and camera object for all Gaia scripts in the scene.

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
  • 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...