I am using a Cinemachine to track my player in Scene1, and as my player enters an invisible Box Collider 2D that I have a script attached to to load scene 2, the warning “Display 1 No Cameras Rendering” appears. I suspect it has something to do with my code, the way my cinemachine is set up on my character sprite, or my second scene. As this is my first time using Unity, I’m not sure where to begin looking for a fix but here.
Here is the code I am using to initiate the scene change:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneTrans : MonoBehaviour
{
public string sceneToLoad;
public void OnTriggerEnter2D(Collider2D other)
{
if(other.CompareTag("Player") && !other.isTrigger)
{
SceneManager.LoadScene(sceneToLoad);
}
}
}
I have my player sprite attached to the CM vcam 1 to Follow and Look At, then a prefab character sprite in the next scene with a stationary cm vcam taking up the full screen for a wide shot with no tracking. Player sprite is tagged Player.
If any of you have any ideas as to why this is occurring, I’d appreciate the suggestions!
Will obviously provide more detail/screencaps if needed.
Probably you have no main camera in scene 2. Usually what people do is have the main camera (with the CM brain) in a “Don’t Destroy on Load” object, so that it persists when the scene changes.
I attempted this method via a few different tutorials online, but was unsuccessful. Instead I have removed the Scene2, put all objects into Scene1, and am trying a simpler method without code.
I’d like to get my Player with a CM vcam that I’ve set to Follow/Look At Player, to smoothly transition into a second still vcam I have set up. This second vcam fills the screen with what was once Scene2.
I gave this a try. When I deactivate vcam1, the main camera defaults to vcam2 and stops following the Player with vcam1.
What I’m looking to have happen is when the player steps in frame of vcam2 it blends.
If they step out of frame of vcam2, it goes back to tracking Player using vcam1.
Don’t deactivate vcam 1. Instead, give vcam2 a higher priority, and activate/deactivate only vcam2. You can use the CinemachineTriggerAction script attached to a trigger shape to activate vcam2 when player enters the trigger, and deactivate it when player exits. No code required.
Thanks so much for your time! This is exactly what I was looking for
Though, I’m having trouble getting it to trigger.
I now have a Box Collider set as a trigger, with vcam 2 applied to it and With Tag set to Player. As well as my player tagged to Player.
I’ve deactivated vcam 2 and set it at a higher priority.
Aha! Thank you so much! That was the issue
I had the player on a layer named Player so particle effects I have going would ignore collision.
Happy to say the scene transition works, but now the snow lands on the box collider haha
UPDATE: Fixed this issue by making a new layer named Floor (which is all I needed Particles to collide with). Then setting all of my particle effects to only collide with this new Floor layer.
Thank you so much for everything! Saved me hours of troubleshooting.