When I draw AnimationCurve Property with odin, A lot of gc is generated, It's 100mb or more

Issue #665 wontfix
HalfLobsterMan created an issue

When I draw AnimationCurve Property with odin, A lot of gc is generated, It's 100mb or more, use [DrawWithUnity] is the same, but unity default draw is ok

I just create a AnimationCurve field

Comments (7)

  1. Tor Esa Vestergaard

    This is a bit of an unfortunate, but unavoidable fact of life. Unity’s animation curve drawing has access to native internal structures. Odin, meanwhile, must use the public animation curve API that Unity provides in order to do its job, and this API allocates a lot of extra data. Thus, if you have an enormous curve, a lot of stuff will be allocated, since Unity’s API is so wildly inefficient and does not give us direct access to the inspected data, but passes us complete new copies of everything whenever we ask for it. As such, we can’t really fix this issue, I’m afraid. Or at least, we cannot fix it without introducing a lot of bugs and limitations to Odin's drawing and handling of animation curves.

  2. Tor Esa Vestergaard

    I suggest that, for the types that contain such massive curves, you disable Odin drawing entirely in the preferences > editor types window.

  3. kris rok

    hi @Tor Esa Vestergaard , i stumbled upon the same thing and i understand it’s not possible to draw AnimationCurves without those allocations. i added [HideInPlayMode because it only really is a problem in playmode (regular 500ms freezes). but this does not help either. is there a way to actually skip the performance heavy part if the drawer is hidden?

  4. Log in to comment