Search Unity

[saveduringplay] For Custom Cinemachinecomponent Doesn't Seem To Work?

Discussion in 'Cinemachine' started by Baste, Apr 12, 2019.

  1. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    I've got a custom CinemachineComponent, that I've attached the [SaveDuringPlay] attribute to. I've also toggled the "save during play" checkbox on the vCam with this component on it.

    That doesn't seem to do anything, my values gets reverted to the starting values after exiting play mode. The built-in components does get saved, so there seems to be a difference.

    I can't really tell by browsing the code how the [SaveDuringPlay] attribute is processed. Is there a custom inspector I have to have my component inherit from?
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    You just need the [SaveDuringPlay] on your class. The rest is automatic, not dependent on inspectors. If you like, you can PM me the class and I can take a look at it.
     
  3. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    It does not work for data in collections such as arrays or lists.
     
  4. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    Sorry, Works for array, but not for list.
     
  5. xiao-xxl

    xiao-xxl

    Joined:
    Nov 16, 2018
    Posts:
    48
    Remove array item works, but add array item not wrok.
     
  6. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    I could reproduce a bug with Lists, but not with arrays (e.g. int[]). We'll investigate further.
     
  7. omangbaheti

    omangbaheti

    Joined:
    Jun 17, 2020
    Posts:
    1
    Hey @Baste were you able to make it work. I'm facing the same problem
     
  8. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Can't remember! I think we stopped solving that particular problem with a CinemachineComponent, so it stopped being relevant.