Hello there,
I’m having a problem with cinemachine.
As you can see below, the maincamera works normally before adding the cinemachine, but when you add the cinemachine, the game screen stays blue.
before cinemachine
after
Hello there,
I’m having a problem with cinemachine.
As you can see below, the maincamera works normally before adding the cinemachine, but when you add the cinemachine, the game screen stays blue.
before cinemachine
after
Looks like your camera isn’t where you expect it to be.
Welcome to debugging!
You must find a way to get the information you need in order to reason about what the problem is.
Once you understand what the problem is, you may begin to reason about a solution to the problem.
What is often happening in these cases is one of the following:
To help gain more insight into your problem, I recommend liberally sprinkling Debug.Log()
statements through your code to display information in realtime.
Doing this should help you answer these types of questions:
Knowing this information will help you reason about the behavior you are seeing.
You can also supply a second argument to Debug.Log() and when you click the message, it will highlight the object in scene, such as Debug.Log("Problem!",this);
If your problem would benefit from in-scene or in-game visualization, Debug.DrawRay() or Debug.DrawLine() can help you visualize things like rays (used in raycasting) or distances.
You can also call Debug.Break() to pause the Editor when certain interesting pieces of code run, and then study the scene manually, looking for all the parts, where they are, what scripts are on them, etc.
You can also call GameObject.CreatePrimitive() to emplace debug-marker-ish objects in the scene at runtime.
You could also just display various important quantities in UI Text elements to watch them change as you play the game.
If you are running a mobile device you can also view the console output. Google for how on your particular mobile target, such as this answer or iOS: How To - Capturing Device Logs on iOS or this answer for Android: How To - Capturing Device Logs on Android
Another useful approach is to temporarily strip out everything besides what is necessary to prove your issue. This can simplify and isolate compounding effects of other items in your scene or prefab.
Here’s an example of putting in a laser-focused Debug.Log() and how that can save you a TON of time wallowing around speculating what might be going wrong:
When in doubt, print it out!™
Note: the print()
function is an alias for Debug.Log() provided by the MonoBehaviour class.
Please note, the 2D team don’t own, developer or support Cinemachine. It has its own team and forum which you can find here: Unity Engine - Unity Discussions
I’ll move your post for you.
One obvious thing I observe in your image is that the Main Camera is scaled. I’ve never done that and would never recommend it (or at least I can’t think of a case where that would be a good idea!)…not sure what effect that has on your game camera logic pre-Cinemachine. The Cinemachine camera isn’t scaled, and it’s entirely possible that your camera (or what it’s looking at) is out of position as a result.
Kurt’s recommendations for debugging the problem look really good to me.