Jump to content

Water System: The player was null or no camera was found in your scene


mroshaw
Go to solution Solved by Bryan,

Recommended Posts

Hi!

I've created a brand new project in Unity 2021.3, added Gaia, created a terrain. I've then created an Invector 3rd person shooter controller, using the Gaia Manager to configure a "Custom" player controller.

Whenever I start the scene, I get a warning from PW Water:

Water System: The player was null or no camera was found in your scene.
UnityEngine.Debug:LogWarning (object)
Gaia.PWS_WaterSystem:ConfigurePlayerAndCamera () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:1256)
Gaia.PWS_WaterSystem:LoadResources () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:1200)
Gaia.PWS_WaterSystem:StartAndOnEnabled () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:300)
Gaia.PWS_WaterSystem:OnEnable () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:230)
  1. In the Gaia Runtime component, the camera is assigned ("Main Camera").
  2. Under "Water Surface", in the "PWS_Water System" component, the Player is assigned ("vShooterController Instance").
  3. The camera is the only camera in the scene and has the tag "MainCamera".
  4. Debugging, this is the line that's returning null:
    m_RenderCamera = SceneView.lastActiveSceneView.camera;

    Which I think is in turn due to Application.isPlaying returning false, even when entering play mode via the editor.

Any idea what I'm missing here?

Thanks again!

Link to comment
Share on other sites

  • Solution
13 hours ago, mroshaw said:

Hi!

I've created a brand new project in Unity 2021.3, added Gaia, created a terrain. I've then created an Invector 3rd person shooter controller, using the Gaia Manager to configure a "Custom" player controller.

Whenever I start the scene, I get a warning from PW Water:

Water System: The player was null or no camera was found in your scene.
UnityEngine.Debug:LogWarning (object)
Gaia.PWS_WaterSystem:ConfigurePlayerAndCamera () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:1256)
Gaia.PWS_WaterSystem:LoadResources () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:1200)
Gaia.PWS_WaterSystem:StartAndOnEnabled () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:300)
Gaia.PWS_WaterSystem:OnEnable () (at Assets/Procedural Worlds/Gaia/Scripts/Water System/Reflections/PWS_WaterSystem.cs:230)
  1. In the Gaia Runtime component, the camera is assigned ("Main Camera").
  2. Under "Water Surface", in the "PWS_Water System" component, the Player is assigned ("vShooterController Instance").
  3. The camera is the only camera in the scene and has the tag "MainCamera".
  4. Debugging, this is the line that's returning null:
    m_RenderCamera = SceneView.lastActiveSceneView.camera;

    Which I think is in turn due to Application.isPlaying returning false, even when entering play mode via the editor.

Any idea what I'm missing here?

Thanks again!

We are looking into the latest release of the LTS. 
I will check into this. Have you tried to leave the camera un assigned? 
It should pick the camera up as well this way. 

 

Link to comment
Share on other sites

Thanks Bryan. The code runs a second time, and picks up the camera, so I guess it's either just a timing issue or oddness in 2021.3 LTS. Either way, it doesn't seem to have any material impact - only on my OCD and desire for a clean console at runtime! 🙂

  • Like 1
Link to comment
Share on other sites

Thats good, you could try to assign the camera and save the project and restart. 
Unity works in mysterious way sometimes lol

Link to comment
Share on other sites

  • 1 year later...

Im having the same problem where I load a scene in the background and when I activate the new scene, GaiaGlobal.Instance.m_mainCamera is null, so the function isMoved throws an error.

Link to comment
Share on other sites

22 hours ago, AngelGames said:

Im having the same problem where I load a scene in the background and when I activate the new scene, GaiaGlobal.Instance.m_mainCamera is null, so the function isMoved throws an error.

Have you tried the solution above? 

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