Jump to content

Assign Ambient manager at runtime to the player main camera


UHG

Recommended Posts

hello I need to assign the Ambient manager at runtime: In my scene I have a spawner which will spawn the player with the main camera. In the API there is a moveto method.  But when this is used no ListenerRelay is attached to the player and the Ambient manager is not working. 

What is the correct way to attach the Ambient manager at runtime (not at design time).

thank you very much

Link to comment
Share on other sites

Sorry for the long delay. 
If I remember there is an auto delete as well. 
So it could be that after its being moved it deletes itself. 
 

Link to comment
Share on other sites

Hi Bryan, sorry i do not understand how this helps to assign a player to the ambient manager at runtime. is there no API which does this?  

Link to comment
Share on other sites

If another manager already exists, in OnEnable(), if "m_replaceManagerOnLoad" is enabled, it will destroy the old copy instead. Then if "m_autoMoveManager" is enabled and it is not on the created "AmbienceManager" object, then it will start a coroutine to move to that object.
 
So as long as "m_replaceManagerOnLoad" is true and "m_autoMoveManager" is off, it should stay on the object you place it on.
 
at the end of startup, it will then search for the "AudioListener" in the scene (usually on the camera) and place a "ListenerRelay" component on that object if it isn't the same object as the AmbienceManager.
 
The best solution though would be to not attach the ambience manager to the player and instead, if your AudioListener is on the player you can add a ListenerRelay to it. Then just make sure to update the "m_playerObject" on the manager to point to the new player for position data to be updated properly.

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