Search Unity

  1. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Let us know a bit about your interests, and if you'd like to become more directly involved. Take our survey!
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

cinemachine freelook prefabs seem to become corrupted

Discussion in 'Cinemachine' started by mradfo21, May 24, 2018.

  1. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    Cinemachine freelook cameras seem to have alot of trouble keeping their settings when saved as prefabs. I cant exactly figure out what corrupts their data. But the Top Rig, Middle Rig, Bottom Rig settings seem to get corrupted and reset every now and then. I can tell when this happens too as the arrow next to them disappears

    upload_2018-5-24_11-37-31.png

    when I select one of the corrupted rigs
    upload_2018-5-24_11-38-1.png

    i see this appear in the object heirarchy

    upload_2018-5-24_11-38-19.png


    the ONLY way to keep them for sure is to save via unity collaborate and constantly revert them after working in the project ... man.. what a nightmare
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    oh really ?!
    what version of Unity?
     
  3. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    2018.1.0f1
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    trying to repro... can't seem to do it. Any thoughts on what kind of things you're doing in the editor that might make it happen?
     
  5. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    hehe its slowly corrupting them more and more

    upload_2018-5-24_13-32-54.png

    so i'm not sure. I do have some editor scripts that are running update methods and I do have an

    [InitializeOnLoad]

    that automagically spawns some gameobjects and prefabs into the scenes (but not the cameras).

    I'm not sure but i'll keep testing and see if i can find a pattern
     
  6. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    luckily collaborate's revert is saving me
    upload_2018-5-24_13-36-0.png
     
  7. Feriluce

    Feriluce

    Joined:
    Nov 28, 2013
    Posts:
    5
    I have a very similar, if not the same, problem. I have created a prefab with cinemachinefreelook on it, and it seems that whenever I try to change settings on that prefab, it spawns those 3 rigs in the scene, tries to parent them to the prefab, which fails, and then throws this nullreferenceException.

    Error.png
     
  8. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    hurrah! im not crazy!
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    I really can't repro this!
    Can you tell me which version of Unity, which version of CM, and what exactly are the steps to reproduce?
    I've tried changing all sorts of settings but it refuses to misbehave.
     
  10. Feriluce

    Feriluce

    Joined:
    Nov 28, 2013
    Posts:
    5
    I'm using unity 2018.1.0 and Cinemachine 2.1.13, but I just tried to reproduce it myself, and now it doesn't happen for me either.
    It seems like the problem was in creating the prefab though. When I tried creating new prefabs this time, the 3 child rigs were created underneath the prefab. That didn't happen with the prefab that was broken. That one was just a single object, which I assume is why it kept trying to create the missing rigs.
     
  11. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    Ok here's how I think you repro this. Make a cinemachine prefab out of a free look. Instantiate it at runtime. Make changes to it. Drag that to make a new prefab on disc. Then drag the camera ontop of the original prefab to replace its settings.

    Now you'll start to see TopRig, MiddleRig, and BottomRig appear in the heirarchy of the game. This means your F***ED. Cinemachine is now destroying your cameras.

    Restart Unity and you'll be greeted with this:

    upload_2018-6-22_17-7-1.png

    Not having the arrows next to your camera is BAD NEWS.

    When you run the game cinemachine will make have erased all your rig settings and there's no way to get them back outside of version control.


    Now this could ALLLLL be avoided if you could actually copy the rig settings during runtime and paste them onto the prefab on disc like every other object in unity. I know you'd mentioned this was working but it does not sadly.
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    Not sure exactly what you mean by that last step.
    After making the second prefab, if I drop my FreeLook from the hierarchy onto the prefab, all is fine, the settings get copied. If I try to drag the second prefab onto the first prefab, I get this:

    upload_2018-6-24_8-13-13.png

    If I click Yes, then click on the profab, then the Top, Middle, and Bottom rigs from the prefab get moved to the hierarchy, and the prefab is broken.

    Is that consistent with what you're seeing?


    If I do this on the FreeLook in the hierarchy:
    upload_2018-6-24_8-27-47.png

    Then this on the FreeLook in the prefab:
    upload_2018-6-24_8-28-32.png

    Then it works perfectly.
    How are you doing it differently?
     
  13. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    Yes! Yhat's exactly what I'm seeing.

    So on my machine using two different versions of cinemachine - the package manager one, AND a beta I was sent of a newer (sexier) version, the Paste Component Values only copies values into that top section, not to any of the rigs. Basically the gear produces this result:
    https://forum.unity.com/threads/copying-properties-from-play-mode-onto-prefabs.532085/

    I'm really sorry this has been so hard to track down. Do you think the behavior repro-'d above is fixable?
     
  14. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    heres when you know its bad

    upload_2018-6-25_22-42-34.png
     

    Attached Files:

  15. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    notice there are no rigs now in the prefab:

    upload_2018-6-25_22-44-47.png
     
  16. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    @mradfo21 Thanks for your persistence and patience!
    I was able to identify and fix a bug that was causing Paste Component Values to only paste the top section of the FreeLook. That fix will be in the next CM update.

    For the orphaned rigs in the scene view, I don't know how you're getting them unless you dragging and dropping a FreeLook onto a prefab FreeLook. In that case, Unity displays this warning dialog:

    upload_2018-6-26_15-56-7.png

    My advice to you: Don't do it. Just say no.

    The correct way to modify a prefab FreeLook is to paste the values onto an instance, then apply that instance back to the prefab.

    upload_2018-6-26_15-58-33.png

    If you do it like that, you won't get any orphan rigs.
     
  17. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    Yeah I've been replacing just to get around the copy paste issue. So it sounds like with the next update this wont even be an issue! I'm super happy you could see that on your end. Cant wait for the new Update! Any ETA on that?

    Great work Gregoryl !
     
  18. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    New update should be available in Preview within the next few days, I'll let you know when it's there.
     
  19. mradfo21

    mradfo21

    Joined:
    May 16, 2013
    Posts:
    181
    This is still suuuuper painful. Any chance this update is coming soon?
     
  20. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    1,637
    Yes, there is a new CM version (2.2.6) in Preview, which is waiting for a final QA pass before it can be released officially. You can grab it from there if you really need it.