Search Unity

Random "cm" gameobjects showing up on Cinemachine Virtual Camera prefabs

Discussion in 'Cinemachine' started by Meatloaf4, Mar 11, 2020.

  1. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    183
    For some strange reason i'm getting random child "cm" gameobjects with a CinemachinePipeline script attached to them randomly appearing.

    Is this some sort of strange 2019.3 bug or is this a cinemachine issue?
     

    Attached Files:

  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Actually it's a known issue. It will happen when you remove the "CinemachineVirtualCamera" component from a vcam. The "cm" child object, which is normally hidden, will then become visible. It's harmless, and you can delete it.
     
    MallNinjaMax and gaborkb like this.
  3. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    183
    Ah got yeah. Is this a Cinemachine bug or is this more of a Unity issue?

    I'm finding it clutters up the hierarchy and causes quite a bit of confusion when trying to debug gameobjects.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    It's a CM thing.
    Normally, you should not be seeing these, ever.
    If you are, it possibly indicates a workflow issue that you can correct.
    What are the steps you have to do to produce this?
     
  5. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    183
    Honestly it all started occurring when I updated to Unity 2019.3 (from 2018.4). As far as I can tell the cm objects randomly appear and then disappear. They are all prefabs so i'm wondering if some issue arose when the prefabs got upgraded.
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    For sure the Unity prefab stuff changed, and as a result may have invalidated a workflow that may have worked for you before.

    If you could put together repro steps and let us know, we could help you find a workaround.
     
  7. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    183
    It still feels a bit seemingly random as to when it occurs but it looks as if it only does it when a virtual camera is made into a prefab.

    Here's my repro steps

    1. Create a project / scene.
    2. Add a cinemachine virtual camera.
    3. Add a framing transposer
    4. Tweak some settings.
    5. Drag gameobject from hierarchy into project view to create a prefab.
    6. When prefab is created sometimes a cm object will appear as a child.

    Also this seems to go hand in hand with the fact that when I go into prefab edit mode for one of these virtual cameras the prefab seems to be immediately marked as though there are changes despite me not touching anything.
     
  8. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    What version of CM?
     
  9. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    183
    Cinemachine 2.5

    upload_2020-3-11_13-1-22.png
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Testing with CM 2.5.0 and Unity 3019.3.3f1, I can't repro your issues when following your steps.
     
  11. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    183
    Ah sorry i should have been more specific on my version.

    I was running 2019.3.4

    upload_2020-3-12_14-41-18.png

    I can double back though and really try and hone down when it occurs as I'm actually having the same issue on 2018.4.17f1 right now.
     
    Gregoryl likes this.
  12. levibme07

    levibme07

    Joined:
    Feb 20, 2021
    Posts:
    2
    Hi, So I installed Cinemachine and then deleted it shortly after because I had no use for it. Now my console has 2 errors saying
    The referenced script on this Behaviour (Game Object 'cm') is missing! When I double click on the errors it show the cm game object. I'm not sure how to delete it.
     
  13. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Just click on the "cm" object it shows you, and press delete.
     
  14. levibme07

    levibme07

    Joined:
    Feb 20, 2021
    Posts:
    2
    I guess I should've been more specific. When I double click the error it opens up visual studio. I then close visual studio and the object shows up in the inspector and in the world. I tried pressing delete on both of them and It didn't work. One odd thing is that It doesn't show up on the hierarchy. Is there a way to unhide it? Also If I keep them in there would it be a problem to my computer or my game?
     
    Last edited: Mar 12, 2021
  15. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    They won't cause problems for your game, but I understand that they're annoying.
    You can write a script that iterates all objects and unhides them using GameObject.hideFlags.
     
  16. DSivtsov

    DSivtsov

    Joined:
    Feb 20, 2019
    Posts:
    151
    Unity 2019.3.14
    Cinemachine 2.6.11
    Scene from "Assets/Samples/Cinemachine/2.6.11/Cinemachine Example Scenes/Scenes/3rdPersonWithAimMode"
    For localization problem was wrote next script
    Code (CSharp):
    1. public class ImHere : MonoBehaviour
    2. {
    3.     private void Awake()
    4.     {
    5.         Debug.Log($"ImHere name={gameObject.name}");
    6.         Debug.Log($"ImHere hideFlags={gameObject.hideFlags}");
    7.         Debug.Log($"ImHere transform.parent.name={gameObject.transform.parent.name}");
    8.         gameObject.hideFlags = HideFlags.None;
    9.         Debug.Log($"ImHere hideFlags={gameObject.hideFlags}");
    10.     }
    11. }
    At console clicked twice on error and replace missed script by my.

    After that in Console received:
    But object in the hierarchy not seeing.

    Duplicate the object ("CM 3rd Person Aim") and deactivate the original change nothing ("errors are going from new object").
    After creating the object from scratch (and copy all parameters with values from original, include all child objects) and deactivate the original all errors disappeared.
    In Scene.unity file exist the objects with name "cm" (the number is the same as the virtual camera number, in my case was two, but "errors going only from one cam").
     
    timmccune likes this.
  17. timmccune

    timmccune

    Joined:
    Sep 27, 2018
    Posts:
    29
    I basically did the same thing as DSivtsov to find out what was causing this warning. After seeing the warning in the console, I clicked on it and replaced the missing script with a similar script as above. Then I right-clicked the script and did a 'Find References In Scene' but nothing was found. But after running the game and aiming, I saw the debug messages that appeared to be coming from the aiming virtual camera. However, the "missing script" I replaced was not attached. So I decided to google to see if anyone else was experiencing this warning, when I came across this thread. I ended up just creating 2 new Virtual cameras and copying the settings over before deleting the old virtual cameras. Now the warning doesn't appear. Using Unity 2021.3.5f1 with Cinemachine 2.8.9 with Samples. Issue was in 3rdPersonWithAimMode example.
     
  18. spakment

    spakment

    Joined:
    Dec 19, 2017
    Posts:
    96
    @Gregoryl I'm getting these same issues in a project upgraded from 2022.2 beta 12 to 2022.2.0f1.
    I have a prefab with around around 15 vcams, there is also a ClearShot cam with the collider extension on the parent. Whenever I open the prefab I can see "cm" child gameobjects, that disappear when I click on their parent. Unable to save the prefab and have to recreate the vcams everytime I open it.
     
  19. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    spakment likes this.
  20. spakment

    spakment

    Joined:
    Dec 19, 2017
    Posts:
    96
    @gaborkb thanks, luckily updating to v3 (3.0.0-pre.3) was my first "fix" and after rebuilding the various scenes (manually) everything is saving and being serialised without the previous issue.
     
  21. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Upgrading manually? Didn't the CM upgrader work for you?
     
  22. spakment

    spakment

    Joined:
    Dec 19, 2017
    Posts:
    96
    Sadly not, the CM upgrader didn't handle the virtual cameras, they had their components on a child "cm" gameobject, some of them had multiple "cm" child objects. The ClearShot script was showing as a missing script so I had to set it up again. CM3 seems more robust so far.
     
  23. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    Really sorry to hear that. Would you be willing to send me a pre-upgraded version of your project? We're really hoping to make the upgrader work for an many use-cases as possible. You project might help us improve it.
     
    gaborkb likes this.
  24. spakment

    spakment

    Joined:
    Dec 19, 2017
    Posts:
    96
    I went back through various git commits to try to build a project for you. Oddly I can't recreate the issue that happened during the upgrade from 2022.2 beta. I don't have the beta installed so I'm just resetting to previous commits and opening in 2022.2.0f1 and it's not triggering / breaking the prefab in the way it did before. Possibly I need to dirty the cache by using the beta version to get the behavior but I'm unable to that now. Sorry not to be able to recreate.
     
  25. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,711
    If you do manage to recreate the problem please let us know
     
  26. IAndrewNovak

    IAndrewNovak

    Joined:
    Nov 29, 2013
    Posts:
    118
    Unity 2022.2.3 HDRP 14.0.5

    Same issue after upgrading from Cinemachine 2.9.4 to 2.9.5

    After deleting a Library folder and regenerating it - the problem is gone (after reopening the prefab a few times and saving the prefab, "cm" game object disappears).

    Watch the log. I think the problem is from the package cache. See screens and log after update to v2.9.5
     
    Last edited: Feb 1, 2023