Search Unity

Vector3 and other structs optimization of operators

Discussion in 'Scripting' started by Aka_ToolBuddy, Jun 17, 2017.

  1. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    There is no need to thank me for patience! We're having a great discussion here. I apologize if I came off as harsh at all - that was not my intention.

    I appreciate the investigation and feedback. It is a gift.
     
  2. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    No, you were not harsh at all. I am happy we had this discussion.

    So on my side, as a conclusion, I get that the IL based micro-optimizations in FRB do not translate to the c++ world, probably because of the differences between .Net's JIT and the c++ compilers. My limited knowledge about compilers, and unwillingness to spend a huge amount of time learning about them right now, makes me accept that FRB should for now stay compatible only with Mono builds. Would happily follow any findings you make about this subject.
     
    JoshPeterson likes this.
  3. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    "Burst" il2cpp makes sense as it's easier to optimize that than C++ compiler. It goes beyond simple math operations but also about what I've written about in Unity.Mathematics thread (and what's written on https://jacksondunstan.com/?s=il2cpp). I wish there was a callback to do it ourselves, something like "IIl2CppProcessor.OnAfterConvertRun" as "before" version already exists https://docs.unity3d.com/ScriptReference/Build.IIl2CppProcessor.OnBeforeConvertRun.html. That would allow us to also quickly check if C++ compiler is doing proper optimizations. Only way of doing it I've found is to make 2 builds, one with "Create Visual Studio Solution" then modify C++, build and combine with first one.
     
  4. Vincenzo

    Vincenzo

    Joined:
    Feb 29, 2012
    Posts:
    146
    The main issue we have is mono anyway, everything is a function call. and it just adds up.

    Another issue is that mathf is having a lot of function calls aswell, and nothing is being inlined, so it's hell.
    I recently pointed this out here: where I use as example a raycast.
    https://forum.unity.com/threads/is-using-burst-as-simple-as-checking-a-box.899684/#post-5915207

    Another point is that I made a copy of all the mathf class and manually inlined every function, and it gave a 4x speedup average on my math heavy stuff. that is significant.

    Because mathf is implemented in such a way that a single math call could mean clamping, adding and multiplying vectors, doing calls to mathf other functions that in turn call other functions. it's just sad really. I doubt even il2cpp inlines it because its all without any aggressive inlining markers.

    This could be easy solved by unity, just fix up the mathf class, would take 1 day work. and benefit everybody using it, which is well.. everyone.
     
    Last edited: Jun 11, 2020
    DragonCoder likes this.
  5. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Was it in editor or in a Mono build?
     
    Last edited: Jun 11, 2020
  6. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I'm curious, what would code in this IIl2CppProcessor.OnAfterConvertRun check do? Would it inspect generated binary code from the C++ compiler? I'm not sure about your use case.
     
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    IL2CPP should emit all UnityEngine.Mathf methods as the corresponding C standard library calls (e.g. Mathf.Sqrt becomes sqrtf). I think this will give the C++ compiler the best chance to optimize them. Do you see this not happening?

    But I agree, the Mathf methods should be labeled for AggressiveInlining so that Mono will inline them as well. We will try that out and check the performance results.
     
    Vincenzo and Noisecrime like this.
  8. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    Yes, almost. I guess it may not be the case for mono.

    It simply would search and replace generated c++ before "c++ to assembly" compilation. For ex. when I've found that Unity.Mathematics.math.sin is ~15 times slower than Math.Sin in il2cpp:
    I could simply regex replace:
    Code (CSharp):
    1. math_sin_m7CB1E8DF153CC3E22A6C366F3F5F98571CF77BA9((2.435f), /*hidden argument*/NULL);
    to
    Code (CSharp):
    1. sinf(2.345f)
    I guess could also remove all "IL2CPP_RUNTIME_CLASS_INIT(Mathf_tFBDE6467D269BFE410605C7D806FD9991D4A89CB_il2cpp_TypeInfo_var);" to make Mathf faster.
     
    glenneroo likes this.
  9. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Thanks for the details. I don't expect that we will expose a callback to allow the generated C++ code to be modified. We treat the generated code as an internal detail, and don't make any guarantees about it from release to release.

    With that said, we can look at having IL2CPP do this translation for Unity.Mathematics methods automatically.
     
    Vincenzo likes this.
  10. scsc

    scsc

    Joined:
    Oct 22, 2016
    Posts:
    3
    @JoshPeterson if I understand it correctly, was the point of the entire previous discussion simply finding out whether a "constructor is more expensive for C++ compared to creating a struct directly"? I mean wouldn't this be a huge issue of the IL2CPP due to the fact that users often use their own structs even if they don't use the Vector3 library? I don't really understand why this issue could stay ignored anymore as low proprity if it's so straightforward that everyone who inspects the code sees the issue immediately. As was also mentioned here, Editor performance matters too, and the Unity profiler now displays the performance loss (which is sometimes arguably even worse than a negligible temporary assembler performance issue that'll get fixed on its own anyway, if it's guaranteed to cost every single new Unity developer at least few hours of their time, because everyone profiling vectors will eventually find out about this).

    Regarding the point number 2: "Can the Vector3 C# implementation be improved to provide better performance?", could you please also try to address the following points I previously mentioned?

    * Vector3.Distance internally uses the expensive constructor (due to C# struct behavior)
    * Operators like - also use the expensive constructor, and they are further required by methods like "Vector3.SqrMagnitude(b - a)". Also is there a reason why it would be hard to add a new high-performance overload with parameters that cover the most popular use-case, in a way such that the user doesn't have to do the "square" operation manually, making the code harder to read and more error-prone if expressions are complex?
    * Regarding function call, C# now finally supports an "in" (readonly ref) modifier of the parameter, such as "in Vector3 a" instead of "Vector3 a", and it seems to reduce the function call overhead by 10% - 50%, as the struct isn't unnecessarily copied. Is there any reason why all the similar math-heavy operations cannot simply utilize this easy improvement? Shouldn't passing a reference be an obvious path forwrad in all performance-critical parts of the code, providing additional free safety and self-documentation about the intention? There may also be more useful features of the latest C# version.
    * The well-known micro-optimization of replacing Distance by "SqrMagnitude(b - a) > greaterThan * greaterThan" could benefit from all of the previous improvements, but on top of that I'd like to ask, is there a reason why the more direct expression like "Distance(a, b) > greaterThan" cannot be also automatically compiled to the Sqr variant, so that people can prefer a more declarative approach? For example, I was already met with a backlash from Mirror developers regarding this micro-optimization in their code, as they already had a negative experience, and now they prefer "clean code", while this definitely looks like a hack < https://github.com/vis2k/Mirror/pull/1514#discussion_r384335611 >. So as long as there are similar deterministic use-cases (for example where the partial results aren't being passed around anywhere in the code), is there a reason why Unity doesn't try to automatically replace the well known patterns within IL2CPP? This may be also related to things like LINQ and foreach, which for some reason still provide less performance than their other equivalent. And let's not forget about stuff like constant strings, which could be also easily replaced by their reference, yet this isn't happening either and the objects are being created anew. If gaining performance like this isn't a priority of Unity whatsoever, could you please at least point me to some alternative option, like an example of how to extend the IL2CPP myself? I'm sure the future of C# lies in more intelligent compilers ;)
     
    glenneroo and Vincenzo like this.
  11. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    This should be simplified but I see Unity doesn't want us to write C++. I guess we could make il2cpp.exe wrapper to add "IIl2CppProcessor.OnAfterConvertRun" callback ourselves.
     
  12. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    It's not that we don't want users to write C++. The reason we don't expose this is the the C++ generated by IL2CPP is not intended to be a stable API of any sort. It is in intermediate representation only, and we can't afford to support it like a public API. It changes very often.
     
  13. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    The point of discussion 1 was to understand whether or not IL2CPP was converting the IL code as efficiently as possible. I believe that it is, given the constraint the IL2CPP will not optimize the IL code, but simply convert it as-is.

    The constructor call itself specifically it not an issue, as it does not appear in the generated assembly code for either of the two cases.

    With that said, the implementation proposed here has proven to be faster (as shown by a number of users), so we need to profile it ourselves, understand why, and attempt to improve Unity's implementation.

    The reason is that IL2CPP is seldom attempting to optimize. It depends on the C++ compiler to do that. In general, we would like the C# code to be as efficient as possible, rather than depending on IL2CPP to do optimizations. That means Editor performance and Mono performance is good as well.

    Can you provide a specific example of this optimization? I'd like to explore it in-depth to understand the generated assembly code. This might be something the Mono JIT or the C++ compilers behind IL2CPP can understand.

    Thanks for the suggestions! We will explore these.
     
    Last edited: Jun 15, 2020
    Noisecrime likes this.
  14. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Quote of the day :D
     
  15. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    That's fine for me, let us (and plugins like Frame Rate Booster) take care about changes. Being able to inject custom c++ easily is very powerful in terms of performance. I'd rather have this option than wait for Unity to fix il2cpp, issue with static constructors was marked as "Postponed" almost a year ago. https://issuetracker.unity3d.com/is...tialized-and-il2cpp-runtime-class-init-checks I guess it wouldn't be fixed for a long time if not posts in Unity.Mathmetics thread.
     
    Vincenzo and mgear like this.
  16. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I wanted to follow up on this thread. We've now begun tracking this work internally. Our performance team is investigating it with a plan to implement what we've discussed here to improve performance. I don't have any details about a ETA for the changes to be available though. Thanks everyone for the feedback, we really appreciate it.
     
  17. Hurri04

    Hurri04

    Joined:
    Nov 27, 2017
    Posts:
    59
    @JoshPeterson would it be possible to move all Vector classes into a package that gets installed via the package manager? or would this not be possible due to some internal optimizations?

    I'd really like to see some improvements to some of the operator methods as mentioned in this thread but there's most likely a breaking change when using precompiled third-party code. The way I see it moving this to the package manager would allow switching to an updated version if the project permits it. More details here.
     
  18. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    @Hurri04 You could attempt to rewrite the class using Cecil too!
     
  19. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Moving these to packages is not something I've considered, and I've not heard about others at Unity trying it. I suspect that it would improve the situation in the cases you mentioned, but I'm worried about it breaking other cases.

    I suspect this is something that won't happen soon, but I wouldn't rule it out entirely.
     
    Hurri04 likes this.
  20. Hurri04

    Hurri04

    Joined:
    Nov 27, 2017
    Posts:
    59
    I'm pretty sure that this would be against Unity's TOS. And even if it wasn't, the breaking change I mentioned would cause further errors anywhere an implicit V3->V2 cast operator is used in the internal Editor UI code. Changing these to explicit cast operators is something a Unity dev has to do.

    The crux of my issue with the V3->V2 cast operator is that it really shouldn't be implicit but fixing this means a breaking change. The way I see it the package manager presents the perfect solution with the possibility to replace even very core systems which were kept from being updated (to keep sustaining support for legacy systems) by offering newer package versions to the users.

    The main things I'm concerned about with this approach (because I don't have deep enough insight into these parts) are these:
    • Are there any conversions, optimizations, or other interactions happening between C# side and C++ side which would prevent moving the code to a package?
    • And is the assembly/package available (can it be loaded) before it is needed by the internal Editor UI code when starting up Unity? What happens when the package manager is used to change the package version to a newer/older one? Can the assembly simply be reloaded in place of the old one? Or would it require restarting Unity?
    Other than the breaking change I described I'm not really seeing any further problems arising on the user side, since the other suggested changes are essentially "just" syntactic sugar (but even so, I think they'd be really useful to modernise this part of the engine, comparable to e.g. the new responsive Editor UI design).
     
    Last edited: Aug 12, 2020
    glenneroo likes this.
  21. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    No its not against their TOS at all to change code. Other plugins do this, they do this and we have done this too.
     
  22. Hurri04

    Hurri04

    Joined:
    Nov 27, 2017
    Posts:
    59
    https://unity3d.com/legal/terms-of-service/software
    My understanding from 2.6 (General Restrictions) is that this might not be allowed because of this being internal code?
     
  23. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    Hmm, hooking up a thing to prevent Vector3/2 implicit casts would get rid of a lot of bugs.

    Do you know if Cecil allows us to remove things? Like the mentioned cast definition?
     
    Hurri04 likes this.
  24. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    I'm not sure, you might ask JB Evain who made it and also worked with Unity.
     
  25. Hurri04

    Hurri04

    Joined:
    Nov 27, 2017
    Posts:
    59
    From the reddit AMA (I think I also read about this in a Unity blog post but can't find it anymore right now):
    This seems to fit exactly what I described. So if Vectors could be turned into such a core package (with the option to upgrade to a newer/preview version with the suggested changes) that'd be really awesome!
     
    glenneroo likes this.
  26. Hurri04

    Hurri04

    Joined:
    Nov 27, 2017
    Posts:
    59
    Haven't had time to download and test it yet myself but in today's blog post about the new 2021.2 beta it says:
    Does this include anything from this thread?
     
    hippocoder likes this.
  27. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Yes! (I should have provided feedback here, sorry) - one of the work items internally that this thread generated was better use of inlining for math operations in UnityEngine managed code. This change is the completion of that work. I would now expect the best inlining possible for all UnityEngine math operations.
     
    mopthrow, glenneroo, mh114 and 5 others like this.
  28. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Excellent! I came searching for similar information about the beta's notes :) thanks all.
     
  29. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi @JoshPeterson

    Thanks for having considered the optimization discussed in this thread to be part of Unity. That's what I wanted from the start, but never managed to convince Unity to do so, until your intervention.

    Maybe I misunderstood something, but it doesn't seem like the inlining was included.
    I downloaded 2021.2.0b1, then opened Unity\Hub\Editor\2021.2.0b1\Editor\Data\Managed\UnityEngine.dll using ILSpy, then went to the Vector3 multiplication operator, and saw no change. As reference, here is how it should look like:
    https://forum.unity.com/threads/vector3-and-other-structs-optimization-of-operators.477338/

    Can you clarify the situation?
    Thanks
     
  30. Hurri04

    Hurri04

    Joined:
    Nov 27, 2017
    Posts:
    59
    Any updates over here?
     
  31. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    None from me. I haven't checked the latest beta though.
     
  32. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    2021.2b11 it's still using
    new Vector3
    instead of modification of the vector. I also don't see any aggressive inlining attributes added, but maybe they've made that change in their compiler somewhere else.
     
  33. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Unity release 2021.2.0a9 and later should have aggressive inlining attributes for many UnitEngine API math methods. The release notes entry for this was:

    Scripting: Improved runtime performance of many UnityEngine math scripting APIs when using the IL2CPP scripting back-end: Color, Color32, Math, Matrix4x4, Quaternion, Vector2, Vector2Int, Vector3, Vector3Int, Vector4

    During this work we saw internal performance improvements from a low of 2x to a high of 100x, depending on which microbenchmark and platform was checked.

    I'd love to know if these microbenchmark improvements translate into real improvements in Unity project though, so any performance measurements would be appreciated! Sorry that I did not reply sooner when this landed - I was not directly involved in making the changes, and I missed them.
     
    glenneroo, Hurri04 and AcidArrow like this.
  34. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    231
    Any chance to backport these optimizations to e.g. 2020.3. LTS? Would surely be very helpful in the VR space with such high frame rates and almost zero tolerance.
     
  35. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    At the moment we don't plan to back port these changes to 2020.3 LTS. From a technical perspective doing so is possible, but with back ports to LTS releases we are always weighing the benefits against risks of introducing bugs or behavior differences.

    Do you have profiling that indicates these math operations are bottlenecks in 2020.3 LTS? If so that might tip the scales in favor of a back port. But we would need to consider that pretty carefully.
     
  36. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    231
    I completely understand about introducing bugs.

    I don't have any benchmarks but in VR every microsecond counts! It's not like with regular displays, where a bit of lag or low FPS can be ignored - in VR your brain literally thinks you are poisoned and makes you want to vomit or gives you a headache if your game/app can't consistently render @ 72/90/120/144Hz (on both eyes), granted some people are less sensitive, but personally whenever a game stutters even slightly I need to take a break, sometimes for the rest of the day.

    I will try to get some benchmarks using the OVR Metrics Tool i.e. outside of the Editor, though I've never done benchmarking before so I'll have to read up first.
     
  37. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Yeah, I've had the same experiences as well - no pleasant!

    If you can provide any benchmarks or profiles, that you would much appreciated

    I'll also mention that although we want everything to be fast with Unity, we do need to make trade-offs. So if you're really looking to squeeze all of the performance out of math operations, please consider using Burst with the Unity.Mathematics package where possible. This is the highest performance path Unity offers for code like this.
     
    hippocoder likes this.
  38. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Which parts of Unity tend to be a bit slower for convenience ?
     
  39. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    I don't mean for convenience necessarily, but other trade-offs. I can't speak to too many other areas, but when it comes to .NET math-heavy code there are a few examples:
    • Unity's Mono promotes all floating point operations to 64-bit double, then converts back to 32-bit float. The latest Mono Unity ships in 2021.2 has an option to disable this behavior and stick to 32-bit floating point. Enabling it improves performance in some workflows, but will also change floating point rounding in almost all cases, leading to possibly-subtle changes. We're evaluating how to expose this, but it is a trade-off between performance and stability of behavior with previous code.
    • Burst current as intrinsics for Unity.Mathematics, so often the managed code used in Unity.Mathematics is never actually used, and instead lower-level LLVM IR code is used. IL2CPP and Mono don't currently support these intrinsics, so they are executing managed code which might not be as optimized. This is also on the list of things to do, but it is a trade-off between this feature and other features.
     
    NotaNaN, funkyCoty, mgear and 3 others like this.
  40. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    Hi

    First, my own experience: As stated here, "On my other asset, Curvy Splines, I got also a 10% increase for operations like mesh generation and splines cache building."
    Then, the experience of users of Frame Rate Booster:
    • In this twitter thread, @dnlbrgs speaks about the impact of said optimizations on his game Pawarumi. From a discussion I had with him at the time of that tweet, the guy seemed nice and available to talk. So maybe contacting him will bring you the real life information you are looking for.
    • In the reviews page of FRB, there are some people who expressed the asset bring big improvements for their projects. Maybe asking them can be helpful. The one review I saw that gave actual numbers said: "Got a solid + 10-20% FPS depending on areas"

    For this optimization, I really don't see how it can go wrong, as long as basic non regression tests are done to make sure that the new implementations actually do the needed operations. I hope I am not saying this out of ignorance of how wrong such a simple and isolated change can go wrong :D
     
    mgear and glenneroo like this.
  41. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Thanks for the links and information. I'll follow up with them. At this point I can't promise any action on this, but we'll see what we can do.

    My biggest concern is slightly different floating point behavior. We're really wary of making behavior changes in LTS releases for things that already work. We prefer to do that in newer releases.
     
  42. Aka_ToolBuddy

    Aka_ToolBuddy

    Joined:
    Feb 25, 2014
    Posts:
    547
    I get your point, which I find fair enough.
     
  43. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    I absolutely don't see a way I'd be using high performance DOTS any time soon, so improvements to the performance of current Unity are a big deal for me! I'd happy take a few float rounding changes. Heck, quite used to it as a game dev choosing lower precisions.
     
    Vincent454, Peter77 and glenneroo like this.
  44. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Indeed! We're happy to make changes like this in tech stream releases, like we did here. But I'm not sure we will back port the same changes to LTS releases.
     
    Vincent454, Peter77 and hippocoder like this.
  45. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Indeed! I see performance upgrades as actual *features* that deserve top billing in release notes, as should anyone really so long as it's not a regression fix.
     
  46. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Good point, we should have done a better job marketing this!
     
    AcidArrow and hippocoder like this.
  47. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    But that behavior was exclusive to mono, the conversion to 64-bits did not happen in IL2CPP builds. This meams that behavior was actually inconsistent between the editor and the vast majority of build targets, where IL2CPP is the only available runtime.
     
    Noisecrime likes this.
  48. Hurri04

    Hurri04

    Joined:
    Nov 27, 2017
    Posts:
    59
    I think this would be a great opportunity* to revisit the idea of putting Vectors into a package so these changes could be released as a new version, giving users the freedom to test if it works for them or going back to the previous version if it does not, while also giving you a lot more feedback.

    In the spirit of "Extension Everything" for C# I'd like to see something akin to "Package Everything" for Unity, making the engine even more modular and allowing to replace these modules with different versions.

    One huge step in that direction would be the possibility to have git dependencies in custom packages imo, since this would allow for powerful dependency-chaining. Sadly that topic also has gotten a bit stale over there.

    *) For future versions. I agree that it's probably not a good idea to backport such a new feature into an LTS version now. But it would've been nice to have, for exactly this use case ;)
     
    Last edited: Sep 14, 2021
    glenneroo likes this.
  49. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,073
    Is this improvement also inlining our custom functions that are operating only with Mathf and vectors ?
    And similar functions but in nested chain ?
     
    Bunny83 likes this.
  50. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,936
    Bunny83 and koirat like this.