Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Feedback Why can't I paste child scripts "as values"?

Discussion in 'Editor & General Support' started by MrLucid72, May 27, 2020.

  1. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    847
    The parent vals are guaranteed to be in the child vals, so why wouldn't I be able to paste in child script vals in editor? Seems counter-intuitive~ So much that it even feels like a bug.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,907
    Can you give me an example of what it is you are trying to do?
     
  3. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    847
    Foo component
    -field A
    -field B
    -field C
    -... Field Z

    FooChild component
    -all default vals of base Foo

    I want to copy vals of Foo to FooChild component.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    4,907
    Ok, I understand. It sounds simple enough, just check if the class is derived and perform a patch of the property data however in the area it is done the type information is limited(its C++ not C#). I'll bring it up internally however it's actually really simple to do from C#.
    I just did it https://gist.github.com/karljj1/ccace256567c5a32c0422064d51d311b
    Ill see if there's a reason why we cant bring this code over to C#
     
    Last edited: May 27, 2020
    MrLucid72 likes this.
  5. MrLucid72

    MrLucid72

    Joined:
    Jan 12, 2016
    Posts:
    847
    Whoa, incredible and so simple -- Thanks for the workaround!! I can use this right away :)
     
    karl_jones likes this.
unityunity