21 comments

  • luaKmua13 hours ago
    In general when game development comes up here I tend not to engage as professional gamedev is so different than what other people tend to deal with that it&#x27;s hard to even get on the same page, but seeing as how this one is very directly dealing with my expertise I&#x27;ll chime in.<p>There are few things off with the this post that essentially sound as someone more green when it comes to Unity development (no problem, we all start somewhere).<p>1. The stated approach of separating the simulation and presentation layers isn&#x27;t all that uncommon, in fact it was the primary way of achieving performance in the past (though, you usually used C++, not C#).<p>2. Most games don&#x27;t ship on the mono backend, but instead on il2cpp (it&#x27;s hard to gauge how feasible that&#x27;d be from this post as it lacks details).<p>3. In modern Unity, if you want to achieve performance, you&#x27;d be better off taking the approach of utilizing the burst compiler and HPC#, especially with what appears to be happening in the in sample here as the job system will help tremendously.<p>4. Profiling the editor is always a fools errand, it&#x27;s so much slower than even a debug build for obvious reasons.<p>Long story short, Unity devs are excited for the mentioned update, but it&#x27;s for accessing modern language features, not particularly for any performance gains. Also, I&#x27;ve seen a lot of mention around GC through this comment section, and professional Unity projects tend to go out of their way to minimize these at runtime, or even sidestep entirely with unmanaged memory and DOTS.
    • torginus5 hours ago
      I think you&#x27;ve unfortunately got suckered in by Unity marketing wholesale, and things would stand to be cleared up a bit.<p>Unity&#x27;s whole shtick is that they make something horrible, then improve upon it marginally. The ground reality is that these performance enhancement schemes still fall very much short of just doing the basic sensible thing - using CoreCLR for most code, and writing C++ for the truly perf critical parts.<p>IL2Cpp is a horror-kludge of generated code, that generates low-quality C++ code from .NET IL, relying on the opitmizing compiler to extract decent performance out of it.<p>You can check it out: <a href="https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;il2cpp-internals-a-tour-of-generated-code" rel="nofollow">https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;il2cpp-internals-a-to...</a><p>The resulting code gives up every possible convenience of C# (compile speed, convenience, debuggability), while falling well short of even modern .NET on performance.<p>The Burst compiler&#x2F;HPC# plays on every meme perpetuated by modern gamedev culture (structure-of-arrays, ECS), but performance wise, generally still falls short of competently, but naively written C++ or even sometimes .NET C#. (Though tbf, most naive CoreCLR C# code is like 70-80% the speed of hyper-optimized Burst)<p>These technologies needless to say, are entirely proprietary, and require you to architect your code entirely their paradigms, use proprietary non-free libraries that make it unusable outside unity, and other nasty side effects.<p>This whole snakeoil salesmanship is enabled by these cooked Unity benchmarks that always compare performance to the (very slow) baseline Mono, not modern C# or C++ compilers.<p>These are well-established facts, benchmarked time and time again, but Unity marketing somehow still manages to spread the narrative of their special sauce compilers somehow being technically superior.<p>But it seems the truth has been catching up to them, and even they realized they have to embrace CoreCLR - which is coming soonTM in Unity. I think it&#x27;s going to be a fun conversation when people realize that their regular Unity code using CoreCLR runs just as fast or faster than the kludgey stuff they spent 3 times as much time writing, that Unity has been pushing for more than a decade as the future of the engine.
      • pjmlp3 hours ago
        The biggest issue is that Unity is at the same time, the farol beacon for doing game develpment in C#, that Microsoft refuses to support, see how much effort Apple puts on game kits for Swift, versus DirectX team.<p>Efforts like Managed DirectX and XNA were driven by highly motivated individuals, and were quickly killed as soon as those individuals changed role.<p>One could blame them for leaving the project, or see that without them managemenent did not care enough to keep them going.<p>While at the same time, since Unity relies on such alternative approaches, it also creates a false perception on how good .NET and C# are in reality, for those devs that never learned C# outside Unity.<p>In a similar way it is like those devs that have learnt Java in Android, and get sold on the Kotlin vs Java marketing from Google, by taking Android Java as their perception of what it is all about.<p>Going back to game development and .NET, at least Capcom has the resources to have their own fork of modern .NET, e.g. Devil May Cry for the Playstation was done with it.<p>&quot;RE:2023 C# 8.0 &#x2F; .NET Support for Game Code, and the Future&quot;<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=tDUY90yIC7U" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=tDUY90yIC7U</a>
        • torginus3 hours ago
          Very interesting talk, will definitely watch when I have the time!<p>XNA was very influential for me as well - when I was in high school, I tried to get into 3D game dev, and I started with Frank. D Luna&#x27;s otherwise excellent book on DirectX gamedev - man that thing was a tome. However, having to learn DirectX, C++, linear algebra, shaders, WIN32 API, COM etc. at the same time (which to be fair were explained very thoroughly by the book), was just too much for me back then, not to mention the absolute pain of trying to get models and assets in the game.<p>Later on I discovered XNA, and it was a breath of fresh air for me - a much easier language, good IDE support and a decent way of importing assets, and an much nicer API made it so much easier to get started.<p>And the truly great thing about it was that it didn&#x27;t dumb things down or hide stuff from the developer - it merely provided sane defaults, and utility functions so that you didn&#x27;t have to engage with all that complexity at once.<p>I think Unity was also great as well, at least in the beginning (the first decade of existence), but it&#x27;s chief issue is that Unity&#x27;s &#x27;dialect&#x27; of C# was very different from how you programmed in regular C# (or mostly any other engine) - my feeling is that Unity should&#x27;ve spun their own language&#x2F;runtime rather than trying to make C# into what it wasn&#x27;t designed to be.
          • pjmlp2 hours ago
            They did, hence Boo<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Boo_(programming_language)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Boo_(programming_language)</a><p>I would argue that C# has always been a good alternative for games, starting with Arena Wars, the problem was Microsoft not being serious about AOT or low level programming, because that was left for C++&#x2F;CLI.<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Arena_Wars" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Arena_Wars</a><p>Here is the person responsible for pushing XNA, even though management wasn&#x27;t into it.<p>&quot;The billion dollar decision that launched XNA&quot;<p><a href="https:&#x2F;&#x2F;youtu.be&#x2F;wJY8RhPHmUQ?si=_3pic4pEiOlqQzvm" rel="nofollow">https:&#x2F;&#x2F;youtu.be&#x2F;wJY8RhPHmUQ?si=_3pic4pEiOlqQzvm</a><p>When she left Microsoft, XNA was promptly replaced by DirectXTK, because C++ is the only true way for DirectX team,<p><a href="https:&#x2F;&#x2F;walbourn.github.io&#x2F;directxtk&#x2F;" rel="nofollow">https:&#x2F;&#x2F;walbourn.github.io&#x2F;directxtk&#x2F;</a>
      • doctorpangloss27 minutes ago
        While I get that you’re making a stylized comment, it’s a big drag. It’s one of those, “everyone is an idiot except me” styles. By all means, make a game engine that people will adopt based on CoreCLR (or whatever).<p>It’s not saying much that everything has tradeoffs. During the “decade” you are talking about, CoreCLR didn’t have a solution for writing anything for iOS, and today, it isn’t a solution for writing games for iOS. What you are calling kludges was ultimately a very creative solution. Usually the “right” solution, the nonexistent one that you are advocating with, ends with Apple saying no.<p>That is why Unity is a valuable piece of software and a big company: not because of C# runtimes, but because they get Apple and Nintendo to say yes in a world where they usually say no.
    • iliketrains11 hours ago
      Author here, thanks for your perspective. Here some thoughts:<p>&gt; approach of separating the simulation and presentation layers isn&#x27;t all that uncommon<p>I agree that some level of separation is is not that uncommon, but games usually depend on things from their respective engine, especially on things like datatypes (e.g. Vector3) or math libraries. The reason I mention that our game is unique in this way is that its non-rendering code does not depend on any Unity types or DLLs. And I think that is quite uncommon, especially for a game made in Unity.<p>&gt; Most games don&#x27;t ship on the mono backend, but instead on il2cpp<p>I think this really depends. If we take absolute numbers, roughly 20% of Unity games on Steam use IL2CPP [1]. Of course many simple games won&#x27;t be using it so the sample is skewed is we want to measure &quot;how many players play games with IL2CPP tech&quot;. But there are still many and higher perf of managed code would certainly have an impact.<p>We don&#x27;t use IL2CPP because we use many features that are not compatible with it. For example DLC and mods loading at runtime via DLLs, reflection for custom serialization, things like [FieldOffset] for efficient struct packing and for GPU communication, etc.<p>Also, having managed code makes the game &quot;hackabe&quot;. Some modders use IL injection to be able to hook to places where our APIs don&#x27;t allow. This is good and bad, but so far this allowed modders to progress faster than we expected so it&#x27;s a net positive.<p>&gt; In modern Unity, if you want to achieve performance, you&#x27;d be better off taking the approach of utilizing the burst compiler and HPC#<p>Yeah, and I really wish we would not need to do that. Burst and HPC# are messy and add a lot of unnecessary complexity and artificial limitations.<p>The thing is, if Mono and .NET were both equally &quot;slow&quot;, then sure, let&#x27;s do some HPC# tricks to get high performance, but it is not! Modern .NET is fast, but Unity devs cannot take advantage of it, which is frustrating.<p>By the way, the final trace with parallel workers was just C#&#x27;s workers threads and thread pool.<p>&gt; Profiling the editor is always a fools errand<p>Maybe, but we (devs) spend 99% of our time in the editor. And perf gains from editor usually translate to the Release build with very similar percentage gains (I know this is generally not true, but in my experience it is). We have done many significant optimizations before and measurements from the editor were always useful indicator.<p>What is not very useful is Unity&#x27;s profiler, especially with &quot;deep profile&quot; enabled. It adds constant cost per method, highly exaggerating cost of small methods. So we have our own tracing system that does not do this.<p>&gt; I&#x27;ve seen a lot of mention around GC through this comment section, and professional Unity projects tend to go out of their way to minimize these at runtime<p>Yes, minimizing allocations is key, but there are many cases where they are hard to avoid. Things like strings processing for UI generates a lot of garbage every frame. And there are APIs that simply don&#x27;t have an allocation-free options. CoreCLR would allow to further cut down on allocations and have better APIs available.<p>Just the fact that the current GC is non-moving means that the memory consumption goes up over time due to fragmentation. We have had numerous reports of &quot;memory&quot; leaks where players report that after periodic load&#x2F;quit-to-menu loops, memory consumption goes up over time.<p>Even if we got fast CoreCLR C# code execution, these issues would prevail, so improved CG would be the next on the list.<p>[1] <a href="https:&#x2F;&#x2F;steamdb.info&#x2F;stats&#x2F;releases&#x2F;?tech=SDK.UnityIL2CPP" rel="nofollow">https:&#x2F;&#x2F;steamdb.info&#x2F;stats&#x2F;releases&#x2F;?tech=SDK.UnityIL2CPP</a>
      • timmytokyo11 hours ago
        &gt;We don&#x27;t use IL2CPP because we use many features that are not compatible with it. For example DLC and mods loading at runtime via DLLs, reflection for custom serialization, things like [FieldOffset] for efficient struct packing and for GPU communication, etc.<p>FieldOffset is supported by IL2CPP at compile time [0]. You can also install new DLLs and force the player to restart if you want downloadable mod support.<p>It&#x27;s true that you can&#x27;t do reflection for serialization, but there are better, more performant alternatives for that use case, in my experience.<p>[0] <a href="https:&#x2F;&#x2F;docs.unity3d.com&#x2F;Manual&#x2F;scripting-restrictions.html" rel="nofollow">https:&#x2F;&#x2F;docs.unity3d.com&#x2F;Manual&#x2F;scripting-restrictions.html</a>
        • iliketrains11 hours ago
          &gt; You can also install new DLLs and force the player to restart if you want downloadable mod support.<p>I am not aware of an easy way to load (managed) mods as DLLs to IL2CPP-compiled game. I am thinking about `Assembly.LoadFrom(&quot;Mod.dll&quot;)`.<p>Can you elaborate how this is done?<p>&gt; there are better, more performant alternatives for that use case, in my experience.<p>We actually use reflection to emit optimal code for generic serializers that avoid boxing and increase performance.<p>There may be alternatives, we explored things like FlatBuffers and their variants, but nothing came close to our system in terms of ease of use, versioning support, and performance.<p>If you have some suggestions, I&#x27;d be interested to see what options are out there for C#.<p>&gt; FieldOffset is supported by IL2CPP at compile time<p>You are right, I miss-remembered this one, you cannot get it via reflection, but it works.
          • timmytokyo10 hours ago
            &gt;I am not aware of an easy way to load (managed) mods as DLLs to IL2CPP-compiled game. I am thinking about `Assembly.LoadFrom(&quot;Mod.dll&quot;)`.<p>Ah, I was thinking native DLLs (which is what we&#x27;re using on a project I&#x27;m working on). I think you&#x27;re right that it&#x27;s impossible for an IL2CPP-built player to interoperate with a managed (Mono) DLL.<p>&gt;If you have some suggestions [re: serialization], I&#x27;d be interested to see what options are out there for C#.<p>We wrote a custom, garbage-free JSON serializer&#x2F;deserializer that uses a fluent API style. We also explored a custom codegen solution (similar to FlatBuffers or protobuf) but abandoned it because the expected perf (and ergonomic) benefits would have been minor. The trickiest part with Unity codegen is generating code that creates little to no garbage.
        • mastax11 hours ago
          Does unity have source generators support? Could make for a good alternative to reflection.
          • CreepGin10 hours ago
            Yes and it works well IME. <a href="https:&#x2F;&#x2F;docs.unity3d.com&#x2F;6000.3&#x2F;Documentation&#x2F;Manual&#x2F;roslyn-analyzers.html" rel="nofollow">https:&#x2F;&#x2F;docs.unity3d.com&#x2F;6000.3&#x2F;Documentation&#x2F;Manual&#x2F;roslyn-...</a><p>Now I think about it, writing SourceGenerators is actually a great fit for AI agents.
      • luaKmua11 hours ago
        Hey there, always appreciate a dialog<p>Per the separation, I think this was far more common both in older unity games, and also professional settings.<p>For games shipping on mono on steam, that statistic isn&#x27;t surprising to me given the amount of indie games on there and Unity&#x27;s prevalence in that environment. My post in general can be read in a professional setting (ie, career game devs). The IL injection is a totally reasonable consideration, but does (currently) lock you out of platforms where AoT is a requirement. You can also support mods&#x2F;DLC via addressables, and there <i>has</i> been improvement of modding tools for il2cpp, however you&#x27;re correct it&#x27;s not nearly as easy.<p>Going to completely disagree that Burst and HPC# are unnecessary and messy. This is for a few reasons. The restrictions that HPC# enforce essentially are the same you already have if you want to write performant C# code as you just simply use Unity&#x27;s allocators for your memory up front and then operate on those. Depending on how you do this, you either can eliminate your per frame allocations, or likely eliminate some of the fragmentation you were referring to. Modern .Net <i>is</i> fast, of course, but it&#x27;s not burst compiled HPC# fast. There are so many things that the compiler and LLVM can do based on those assumptions. Agreed C# strings are always a pain if you actually need to interpolate things at runtime. We always try to avoid these as much as we can, and intern common ones.<p>The fragmentation you mention on after large operations is (in my experience) indicative of save&#x2F;load systems, or possibly level init code that do tons of allocations causing that to froth up. That or tons of reflection stuff, which is also usually nono for runtime perf code. The memory profiler <i>used</i> to have a helpful fragmentation view for that, but Unity removed it unfortunately.
        • Rohansi9 hours ago
          &gt; <i>Modern .Net is fast, of course, but it&#x27;s not burst compiled HPC# fast.</i><p>Sure, but the fact that it is competitive with Burst makes it disappointing. If I&#x27;m going to go through the trouble of writing code in a different (and not portable!) way then it better be significantly faster. Especially when most code cannot be written as Burst jobs unless you use their (new) ECS.<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tbg10101&#x2F;dotnet-burst-comparison" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tbg10101&#x2F;dotnet-burst-comparison</a>
        • iliketrains8 hours ago
          &gt; Going to completely disagree that Burst and HPC# are unnecessary and messy.<p>Making a managed code burst-compatible comes with real constraints that go beyond &quot;write performant C#&quot;. In Burstable code, you generally can&#x27;t interact with managed objects&#x2F;GC-dependent APIs, so the design is pushed towards unmanaged structs in native collections. And this design spreads. The more logic is to be covered by Burst, the more things has to be broken down to native containers of unmanaged structs.<p>I agree that designing things in data-oriented way is good, but why to force this additional boundary and special types on devs instead of just letting them write it in C#? Writing burstable code can increase complexity, one has to manage memory&#x2F;lifetimes, data layout, and job-friendly boundaries, copying data between native and managed collections, etc., not just &quot;writing fast C#&quot;.<p>In a complex simulation game, my experience is that there are definitely things that fit the &quot;raw data, batch processing&quot; model, but not all gameplay&#x2F;simulation logic does. Things like inheritance, events, graphs, AI (the dumb &quot;game&quot; version, no NN), UI, exceptions, etc. And on top of it all, debugging complications.<p>Wouldn&#x27;t you be relieved with announcement: &quot;C# is now as fast as Burst, have fun!&quot;? You&#x27;d be able to do the same data-oriented design where necessary, but keep all the other tings handy standing by when needed. It&#x27;s so close, yet, so far!<p>&gt; The fragmentation you mention<p>What you say makes sense. I&#x27;ve actually spent a lot of time debugging this and I did find some &quot;leaks&quot; where references to &quot;dead objects&quot; were keeping them from being GC&#x27;d. But after sorting all these out, Unity&#x27;s memory profiler was showing that &quot;Empty Heap Space&quot; was the culprit, that one kept increasing after every iteration. My running theory is that the heap is just more and more fragmented, and some static objects randomly scattered around it are keeping it from being shrunk. ¯\_(ツ)_&#x2F;¯
        • CreepGin10 hours ago
          Yeah to me, Burst+Jobs and Compute shaders are so easy to work with in Unity, I haven&#x27;t felt the need to squeeze more perf out of C# in a long time.<p>For modding and OTA stuff I just use a scripting language with good interop (I made OneJS partially for this purpose). No more AOT issue and no more waiting for domain reload, etc.
    • oppo77712 hours ago
      [flagged]
  • reactordev13 hours ago
    Unity has a unity problem.<p>While it’s easy to get in and make something (it’s got all the bells and whistles) it also suffers from the monolith problem (too many features, old code, tech debt).<p>The asset store is gold but their tech feels less refined. It’s leaps and bounds where it was when it started but it still has this empty feel to it without heavy script modifications.<p>There is the problem. The scripting ending designed around mono doesn’t translate as well to CoreCLR and using the same Behavior interface gets a little more complicated.<p>There are times (even with my own engine) that one must let go of the old and begin a new. Dx7-&gt;dx9, dx9-&gt;opengl, opengl-&gt;vulkan, vulkan-&gt;webgpu.<p><i>EDIT</i> I was just thinking, returning to this a couple of minute later, that if Unity wanted to prove they really care about their Core, they would introduce a complete revamp of the editor like Blender did for 3.X. Give more thought to the level editors and prefab makers. Give different workflow views. Editing &#x2F; Animation &#x2F; Scripting &#x2F; Rendering &#x2F; Post<p>As it stands now, it’s all just a menu item that spawns a thing in a single view with a 1999 style property window on the side like Visual Studio was ever cool.
    • jayd1613 hours ago
      I think the major problem with Unity is they&#x27;re just rudderless. They just continue to buy plugins and slap in random features but it&#x27;s really just in service of more stickers on the box and not a wholistic plan.<p>They&#x27;ve tried and failed to make their own games and they just can&#x27;t do it. That means they don&#x27;t have the internal drive to push a new design forward. They don&#x27;t know what it takes to make a game. They just listen to what people ask for in a vacuum and ship that.<p>A lot of talented people at Unity but I don&#x27;t expect a big change any time soon.
      • whstl2 hours ago
        I&#x27;ve seen it happening time and time again in similar companies, and this is a symptom of a problem at the upper levels, which means it won&#x27;t change.<p>C-level set goals are abstract and generic, or sometimes plain naive, and this is often coming from generic requests from the board or VCs.<p>&quot;Hire as many developers as you can, even if there&#x27;s no work right now&quot;, a Softbank request.<p>&quot;Don&#x27;t build, just acquire similar products&quot;, from a Brazilian capital management that ended up killing that company.<p>&quot;Kill this team, their product doesn&#x27;t sell. I don&#x27;t care if all our other product depends on theirs&quot;, from Francisco Partners.<p>Employees who stay can&#x27;t really rock the boat, so it self-selects for non-boat-rocking people. Rockstars who stay must adapt or suffer. Eventually you get so many bad people that you do layoffs.
        • reactordev57 minutes ago
          The thread in all of them is that the CEO listened to other people’s advice instead of leading themselves. When a ship loses its captain…
      • reactordev12 hours ago
        The talent left ship years ago. The core engine’s graphics team is all that’s really left.<p>They also hired Jim Whitehurst as CEO after the previous CEO crapped the bed. Then Jim left as he just didn’t understand the business (he’s probably the one responsible for the “just grab it from the store” attitude). Now they have this stinking pile of legacy they can’t get rid of.
        • JBits6 hours ago
          Has the talent moved to anywhere in particular?
    • DiabloD313 hours ago
      That last step is nonsensical: WebGPU is a shim layer that Vulkan-like layer (in the sense that WebGL is GLES-like) that allows you to use the native GPGPU-era APIs of your OS.<p>On a &quot;proper OS&quot;, your WebGPU is 1:1 translating all calls to Vulkan, and doing so pretty cheaply. On Windows, your browser will be doing this depending on GPU vendor: Nvidia continues to have not amazing Vulkan performance, even in cases where the performance should be identical to DX12; AMD does not suffer from this bug.<p>If you care about performance, you will call Vulkan directly and not pay for the overhead. If you care about portability and&#x2F;or are compiling to a WASM target, you&#x27;re pretty much restricted to WebGPU and you have to pay that penalty.<p>Side note: Nothing stops Windows drivers or Mesa on Linux from providing a WebGPU impl, thus browsers would not need their own shim impl on such drivers and there would be no inherent translation overhead. They just don&#x27;t.
      • MindSpunk9 hours ago
        WebGPU is far from cheap and has to do a substantial amount of extra work to translate to the underlying API in a safe manner. It&#x27;s not 1:1 with Vulkan and diverges in a few places. WebGPU uses automatic synchronization and must spend a decent amount of CPU time resolving barriers.<p>You can&#x27;t just ship a WebGPU implementation in the driver because the last-mile of getting the &lt;canvas&gt; on screen is handled by the browser in entirely browser specific ways. You&#x27;d require very tight coordination between the driver and browsers, and you still wouldn&#x27;t be saving much because the overhead you get from WebGPU isn&#x27;t because of API translation, rather it&#x27;s the cost to make the API safe to expose in a browser.
        • reactordev55 minutes ago
          We already do this by exposing the canvas surface with a semaphore lock. The browser can flip the surface to the canvas (or your app can flip it onto a window surface).<p>It’s just a HINSTANCE pointer.<p>You’re right about the waiting, but that’s entirely app driven. Browsers don’t want to render at 144fps but rather wait until drawing has occurred in order to update the view.<p>wgpu, dawn, already support drawing to arbitrary surfaces (not just a canvas but any window surface).
      • fulafel5 hours ago
        WebGL and WebGPU must robustly defend against malicious web content making the API calls, just like other browser JavaScript APIs, which makes for some overhead and resulted in leaving out some features of the underlying APIs.<p>Vulkan has also evolved a lot and WebGPU doesn&#x27;t want to require new Vulkan features, lacking for example bindless textures, ray tracing etc.
      • StilesCrisis10 hours ago
        I wouldn&#x27;t call it nonsensical to target WebGPU. If you aren&#x27;t on the bleeding edge for features, its overhead is pretty low and there&#x27;s value in having one perfectly-consistent API that works pretty well everywhere. (Similar to OpenGL)
      • reactordev12 hours ago
        I’m foreshadowing a future where they do. Please don’t kill the dream.
        • DiabloD312 hours ago
          I&#x27;m not killing it, but there is no C API written verbatim. WebGL was fucky because it was a specific version of GLES that never changed and you couldn&#x27;t actually do GL extensions; it was a hybrid of 2.0 and 3.0 and some extra non-core&#x2F;ARB extensions.<p>WebGPU is trying to not repeat this mistake, but it isn&#x27;t a 100% 1:1 translation for Vulkan, so everyone is going to need to agree to how the C API looks, and you know damned well Google is going to fuck this up for everyone and any attempt is going to die.<p>Chrome is the cancer killing desktop computing.
          • pjmlp3 hours ago
            And Web, because nowadays when people complain about standards, they mean something that only Chrome or Electron crap does.
          • reactordev11 hours ago
            So use dawn.<p>The problem is the same as it was 20 years ago. There’s 2 proprietary API’s and then there’s the “open” one.<p>I’m sick of having to write code that needs to know the difference. There’s only a need for a Render Pass, a Texture handle, a Shader program, and Buffer memory. The rest is implementation spaghetti.<p>I know the point you’re making but you’re talking to the wrong person about it. I know all the history. I wish for a simpler world where a WebGPU like API exists for all platforms. I’m working on making that happen. Don’t distract.
    • torginus5 hours ago
      Unity somehow manages to break the API of their own features so bad every year or so that their own tutorials don&#x27;t work. You have a solid baseline API that has existed since forever (with known limitations), with stuff like the legacy render pipeline. Every attempt to reform it has only introduced confusion, complexity, and is at some point between experimental and no longer supported.<p>I don&#x27;t agree with you on the Asset Store, for the same reasons - the rate of breakage means that things that are not constantly updated no longer work - and multple versions need to be maintained for parallel engine versions. That combined with the dubious economics of Asset Store (I don&#x27;t think it makes financial sense to even make these things, let alone maintain them), they mostly end up as abandonware.<p>And on the Asset Store if you make something indispensable (which is more often than not something the engine should&#x27;have OOTB, like competent text rendering), one of the following things will happen:<p>- Unity will buy you out, and plop your asset in the engine, without doing any integration work, and will stick out like a sore thumb (TextMeshPro). Good for you, bad for consumers, and sucks if you were making a competitor<p>- They build an in-house solution, that you obviously can&#x27;t compete with, and will have a huge leg up on you because they have engine access (sucks to be you)<p>- The engine will never have that feature, because &#x27;you can just buy it&#x27;, meaning you have to either spends hundreds of dollars&#x2F;euros on dubious quality assets or hunt for open-source versions with generally even more varying usability. UE4&#x2F;5 has a lot of these built in, and AAA quality.
    • LelouBil13 hours ago
      Yeah, I started a project in Unity a while ago, and tried out Godot in the meantime.<p>Unity really feels like there should be a single correct way to do any specific thing you want, but actually it misses &lt;thing&gt; for your use case so you have to work around it, (and repeat this for every unity feature basically)<p>Godot on the other hand, really feels like you are being handed meaningful simple building blocks to make whatever you want.
      • reactordev12 hours ago
        Bingo. They don’t actually understand their users. Instead they’re the Roblox of game making, just provide the <i>ability</i> and let devs figure it out (and then sell it as a script).
    • Rohansi4 hours ago
      &gt; <i>with a 1999 style property window on the side like Visual Studio was ever cool.</i><p>I don&#x27;t think this is fair. I&#x27;d say Unity&#x27;s inspector window is one of the good parts of Unity because it not just a property window. It&#x27;s an immediate mode UI that things can hook into to do a lot more than just property editing.
      • reactordev50 minutes ago
        Yes, the last 8 years has seen that little side drawer used for every. single. unity. feature.
  • Rohansi15 hours ago
    The article doesn&#x27;t cover it but the GC being used by Unity also performs very poorly vs. .NET, and even vs. standalone Mono, because it is using the Boehm GC. Last I heard Unity has no plans to switch IL2CPP to a better GC [1].<p>It&#x27;ll be interesting to see how the CoreCLR editor performs. With that big of a speed difference the it might be possible for games to run better in the editor than a standalone Mono&#x2F;IL2CPP build.<p>[1] <a href="https:&#x2F;&#x2F;discussions.unity.com&#x2F;t&#x2F;coreclr-and-net-modernization-unite-2024&#x2F;1519272" rel="nofollow">https:&#x2F;&#x2F;discussions.unity.com&#x2F;t&#x2F;coreclr-and-net-modernizatio...</a>
    • jayd166 hours ago
      On the one hand, better GC is better but on the other, it doesn&#x27;t matter all that much.<p>You tend to want zero per frame allocation as it is and that would probably not change.<p>As long as your less frequent garbage doesn&#x27;t overtake the incremental GC, that&#x27;s not really an issue either. If it&#x27;s working incrementally as intended stutter shouldn&#x27;t be an issue.<p>In a game there&#x27;s no endless benefit from raw GC throughput like you might see on a server instance that could always push more requests per second.
      • bob10295 hours ago
        The entire point of the incremental GC is to preserve frame latency budget at the expense of raw throughput. If you can guarantee &lt;16ms frames, I&#x27;ll work with whatever you can give me.<p>If your game is allocating so quickly that the incremental GC can&#x27;t keep up, I would argue that solving this with a &quot;faster&quot; GC is just taking you further into hell.
    • llmslave215 hours ago
      Re. the editor speedup, it should outright eliminate the &quot;domain reload&quot; thingy that happens because all of the C# needs to be unloaded and reloaded in response to a change.
      • Rohansi14 hours ago
        Pretty sure that will still be there? It&#x27;ll be different because CoreCLR doesn&#x27;t really have AppDomains but it will still need to unload old assemblies and reload them all again. That&#x27;s the only reliable way to reset everything into a clean state.
        • benaadams13 hours ago
          AssemblyLoadContext.Unload <a href="https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;api&#x2F;system.runtime.loader.assemblyloadcontext?view=net-10.0" rel="nofollow">https:&#x2F;&#x2F;learn.microsoft.com&#x2F;en-us&#x2F;dotnet&#x2F;api&#x2F;system.runtime....</a>
        • llmslave214 hours ago
          But only the assemblies that changed right? Or would it still be all of them?
          • Rohansi10 hours ago
            No, for a full domain reload it reloads everything. This forces all static variables to reset, makes static constructors run again, etc.
    • Rochus15 hours ago
      &gt; because it is using the Boehm GC<p>For what reason? Mono has a pretty good precise GC since many years.
      • Rohansi15 hours ago
        Yes, SGen should be a lot better, but Unity cannot use it because they hold and pass raw pointers around everywhere. That&#x27;s fine for Boehm but not possible with SGen. They&#x27;re working on fixing this already but not sure why they aren&#x27;t planning a move to a better GC.
        • LeFantome11 hours ago
          Well, if they port to .NET (CoreCLR), that will move them to the MS GC.
          • Rohansi10 hours ago
            Yes, but it also puts them in an awkward situation! They recommend (or even require, for some platforms) using IL2CPP for release builds which will still use Boehm GC and not run as quick as CoreCLR.
            • DoctorOW6 minutes ago
              Do they still need IL2CPP if they have AOT? The goal was always to be able to have cross-platform native binaries right?
  • 1a527dd514 hours ago
    &gt; In 2018, Unity engineers discussed that they are working on porting the engine to .NET CoreCLR<p>Hard task, no doubt. Unity needs to throw everything at this problem. C# in general has gotten insanely fast by default. It&#x27;s very much worth taking the time to upgrade&#x2F;update.<p>Whilst we don&#x27;t compare in size and api surface, it took us a few months to get off 472 and onto dotnet6. But once we were on dotnet6, moving to the LTS after that was relatively painless; usually a few hours of work.
  • makotech22115 hours ago
    Yeah I think Unity just doesn&#x27;t have the technical skillset anymore to make the migration to coreclr. It keeps getting delayed and their tech leads keep dropping out.<p>Might I suggest <a href="https:&#x2F;&#x2F;github.com&#x2F;stride3d&#x2F;stride" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;stride3d&#x2F;stride</a>, which is already on .net 10 and doesn&#x27;t have any cross-boundary overhead like Unity.
    • WillPostForFood15 hours ago
      Progress has been painfully slow, but Unity does seem to be moving forward.<p>Unity updates on their plans and progress:<p>2022 - officially announced plans to switch to CoreCLR - <a href="https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;unity-and-net-whats-next" rel="nofollow">https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;unity-and-net-whats-n...</a><p>2023 - Tech update - <a href="https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;porting-unity-to-coreclr" rel="nofollow">https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;porting-unity-to-core...</a><p>Unite 2025 - CoreCLR based player scheduled for Unity 6.7 in 2026 - <a href="https:&#x2F;&#x2F;digitalproduction.com&#x2F;2025&#x2F;11&#x2F;26&#x2F;unitys-2026-roadmap-coreclr-verified-packages-fewer-surprises&#x2F;" rel="nofollow">https:&#x2F;&#x2F;digitalproduction.com&#x2F;2025&#x2F;11&#x2F;26&#x2F;unitys-2026-roadmap...</a>
      • teraflop15 hours ago
        Maybe they are making progress. But given that they first started talking about this in 2018, and then in 2022 they announced that they were planning to release a version with CoreCLR in 2023, and then in 2024 they said it would be in beta in 2025, and now in 2025 they&#x27;re planning to release it as a technical preview in 2026, but they&#x27;re still talking about an &quot;internal proof-of-concept&quot; as though it&#x27;s something coming in the future...<p>As an outsider, it certainly seems like there&#x27;s reason for skepticism.
        • whstl13 hours ago
          I&#x27;ve seen similar things from the inside in other companies. Even existential threats (like lack of Apple Silicon support for performance-critical software), getting heavily delayed because the feature treadmill won&#x27;t stop and the actually important thing is a pet project of some engineer. It is basically death by a thousand papercuts, where nobody can say what the focus is.<p>People complain about web development but working with native apps can be depressing sometimes.
        • cheschire14 hours ago
          Well they made some business decisions in the middle of that timeline that cut their funds quite a bit, not to mention probably scared off some good talent.
          • ACS_Solver13 hours ago
            Not just probably scared off some good talent, they had xoofx leave over disagreements with higher management. xoofx was one of their most senior devs, the guy who started the CoreCLR migration and was leading it.<p>They&#x27;ll get there eventually, but the current roadmap says experimental CoreCLR in late 2026, which then in the best case means production ready in 2027. Unity isn&#x27;t going anywhere, but at least as a dev who doesn&#x27;t care about mobile (which is Unity&#x27;s real market), competing engines have gotten much more attractive in the last couple years and that seems set to continue.
            • whstl2 hours ago
              The funny thing about his resignation is that xoofx had a CoreCLR prototype already working around 2016-ish, but the company had &quot;other priorities&quot; and only took it seriously until recently.<p>The guy should just have been left alone and shielded from company bullshit to do the migration, or empowered to fight.<p>I know this is one sided but: Whoever from high-management lost this guy is an absolute loser waste of space who didn&#x27;t do his job and will blame xoofx for “not fighting harder” or some other bullshit. Fuck companies, and fuck loser managers.
              • ACS_Solver1 hour ago
                I think 2016 is a bit too early but yeah, xoofx first wrote about CoreCLR in 2018 and said he&#x27;d made considerable progress with something like himself and two other engineers doing it as a side project. That is four years before Unity as a company announced the migration as a priority, which in turn is another four years before the current estimate for when they may ship it.<p>From my perspective, Unity seems very poorly managed in recent years. The editor experience isn&#x27;t improving while they continue the usual pattern of shipping features in a poor state where they need another couple versions to become properly usable, and of course they make terrible decisions like the runtime fee, a total insanity that caused a huge loss of trust and boosted Godot development enormously.<p>Of course my perspective is biased by me not being Unity&#x27;s main target market. I work on PC strategy games, which are on Steam. At our studio, we don&#x27;t do mobile, advanced graphics features aren&#x27;t very relevant, and we may have the most complex UI that ever shipped in a Unity game.
          • chris_wot13 hours ago
            Scared off a lot of customers, too.
      • bentt14 hours ago
        Nice link, thanks.
    • 99990000099915 hours ago
      Stride has a fraction of the features as unity.<p>Godot is the only real open source competitor, their C# support is spotty. If I can&#x27;t build to Web it&#x27;s useless for game jams as no one should be downloading and running random binaries.<p>A real sandbox solution with actual GPU support is needed.
      • dustbunny14 hours ago
        Writing C# in godot is a bad choice. Use GDScript and directly write c++ as a module. Skip &quot;HD extension&quot; completely. Godots build system is easy enough to use. Just add new classes to the engine using c++ if you don&#x27;t want to use GDScript. The GDScript workflow is honestly great. Using C# is like the worst of all worlds.
        • enbugger3 hours ago
          GDScript is not very maintainable as the code base grows. It lacks proper refactoring tools (e.g. the ones from Jetbrains Rider), static type checking, flexible object system and many 3rd party libraries which might be needed
        • pjmlp3 hours ago
          Problem is, GDScript still doesn&#x27;t have at least a JIT, and the whole GDextensions boilerplate seems more complicated than it needs to be.
        • joha42703 hours ago
          Are there technical reasons to prefer GDScript over C#?<p>GDScript is undoubtedly better integrated in the engine, but I would have expected C# compare more favorably in larger projects than the game jam sized projects I have made.
        • 99990000099913 hours ago
          I don&#x27;t like C++.<p>It&#x27;s very difficult to me, I generally stick to high level stuff , C#, JavaScript, Python, Dart, etc.
          • chris_wot13 hours ago
            If you can code in C#, how is C++ difficult? Are pointers and the stl that difficult?<p>Not denigrating, genuine question.
            • 99990000099913 hours ago
              One word.<p>Headers.<p>That&#x27;s just the start. The C++ build system and package managers are the stuff if nightmares. Modern languages are significantly easier to use.<p>Don&#x27;t get me wrong, if you offer a job with a 200k base salary and give me 6 months to learn C++ I&#x27;ll do it. But I won&#x27;t enjoy it, and I definitely won&#x27;t do it as a hobby.
              • runevault12 hours ago
                If you use an existing template (and are willing to use scons) GDExtension doesn&#x27;t really have the standard build problems of rigging everything up with CMake&#x2F;etc in my experience. The template is set up to handle the &quot;set up the build&quot; problem for you. Still have the header problem though cannot deny that one.
            • Kwpolska5 hours ago
              You&#x27;re asking if going from a high level language to a low level language on steroids is difficult?<p>Pointers, manual memory management, and the design by committee standard library are not fun.
            • atraac5 hours ago
              I write mostly backend stuff for a living, big chunk of it in Node&#x2F;TS but also C# with modern .NET. I also have to dabble with Unity and Unreal both for work and a hobby project. I technically learned C++ in uni but really, I hate every single second I have to spend doing Unreal Engine work. I genuinely despise how obsolete and hard to write C++ is compared to modern languages. It didn&#x27;t bother me in university because that was all I knew at the time but it&#x27;s hard to justify existence of header files today. Add macros everywhere, really bad compilation errors, really hard to read syntax with a lot of unnecessary bloat and you get something that is just not likable. I&#x27;m sure you can get used to it given enough time spent in that ecosystem, but I can tell you as someone writing 4 different languages on day to day basis, C++ is difficult, and it&#x27;s not because of pointers.
            • DonHopkins8 hours ago
              Java was designed to make fun of C++, then C# was designed to make fun of Java, so you&#x27;re missing two layers of fun.
              • 9999000009998 hours ago
                I can tolerate Java. I&#x27;ve worked a Java dev role recently.<p>I think it&#x27;s overly verbose and probably has a lot of unneeded legacy stuff, but in terms of making money so I can afford donuts, it&#x27;s not bad.<p>My personal favorite language is probably Dart, but it&#x27;s basically useless outside of Flutter and I don&#x27;t have faith in Google to keep Flutter going.<p>I don&#x27;t like low level programming. My dream language is literally an LLM that processes a markdown document where I sorta just describe what I want to happen. With options to call defined functions in a normal programing language<p>If I had money ( VC money) I&#x27;d be working on this.
      • CyanLite29 hours ago
        I think WebAssembly could become that sandboxed solution. .NET Blazor WASM is moving away from mono to CoreCLR (just like Unity, with an early preview in late 2026). WASM now has really good SIMD support, native GC, large memory support, and with WebGPU we could finally see some native WASM games running at native speeds.
      • eole66615 hours ago
        Godot 4 C# web export is coming soon : <a href="https:&#x2F;&#x2F;github.com&#x2F;godotengine&#x2F;godot&#x2F;pull&#x2F;106125" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;godotengine&#x2F;godot&#x2F;pull&#x2F;106125</a>
        • 99990000099914 hours ago
          We&#x27;ll see when it actually ships.<p>I&#x27;ve seen this issue before, they&#x27;re making progress but theirs no firm release date.<p>Plus you then have to extensive testing to see what works in Web builds and what doesn&#x27;t. I REALLY enjoy vibe coding in Godot, but it&#x27;s still behind Unity in a lot of ways.
          • ramon15614 hours ago
            Naive question but why not use GDscript? I haven&#x27;t had any issues with it
            • 99990000099913 hours ago
              I&#x27;ll vibe code stuff in GDscript, and I guess I more or less understand some of it.<p>But C# is what I&#x27;ve used for over a decade. C# has vastly better IDE support. It&#x27;s a more complete language.<p>Plus a lot of C# assets&#x2F;libraries don&#x27;t really have GDScript counterparts.
            • eole6665 hours ago
              I&#x27;ll add that C# have better performances than gdscript. It doesn&#x27;t make a difference for most of the things you code in a game, but it comes in handy when needed.
    • linguistics__1 hour ago
      &gt; Yeah I think Unity just doesn&#x27;t have the technical skillset anymore<p>It&#x27;s not a technical skillset issue, it&#x27;s a case of lacking resources, leadership changing priorities and changing requirements mid-development, causing a lot of work to be redone.<p>We still have highly skilled developers working in this area, if we can just actually be allowed to do (and keep) we work we have.
    • darubedarob5 hours ago
      Imagine you have to communicate that rewrite and drop of support for bought &quot;addons&quot; to the people who went on that shopping spree. Who then would have to explain the &quot;wecan&quot;-value drop + cost of recovery of the same abilities to the shareholders and customers. The magpiesnest of bought companies tech is a tarbaby for any tech lead, the rewrite a career ender for the CEOs office.
  • tyleo1 hour ago
    I wrote the Circuits programming system for Rec Room, and we took a similar approach: keeping the core logic free of Unity dependencies so it could run and be tested on CoreCLR.<p>The results were similar as well with significantly better performance outside of Unity. There are also secondary benefits. Unity’s API surface is huge, and it’s easy for code to accidentally entangle itself with engine details in ways that confuse or constrain other developers.<p>By isolating the core in a separate DLL, we only expose Unity concepts where they’re actually needed, and we enforce that boundary with tests. That logic constraint ended up being just as valuable as the performance gain
  • BatteryMountain7 hours ago
    My dream would be that I can adb into my phone, install the .Net SDK or .Net Runtime (v 8 or 10) and have my applications run natively on Android. Simple console apps first, then the rest. Google should open their platform up a little bit more. Allow us to enable root access via adb. Let us unleash our pocket computer&#x27;s full potentials. Would love to have portable low powered servers, running stacks of my choice. They are super efficient already, have large storages, I can already plug in a usb-c hub into my phone to get more storage, LAN network, keyboard&#x2F;mouse, external mic if needed. Running my phone with wireguard&#x2F;tailscale + some lightweight containers = awesome!<p>Unity really do need to catch up though. .Net 8&#x2F;10 is really amazing and FAST. With the new garbage collector changes for .Net 10, game stutter would be nearly gone gone.<p>Unrelated point: I basically stream most of my games with Sunlight + Moonlight from my main rig to my phone with a controller attached, so I can play Diablo 2 remastered, Hades, Grim Dawn and basically any game with Xbox controller support, directly on my phone. Works amazingly well. Phones has high dpi screen + 120hz OLED panel and since all rendering happens on my headless gaming server, at highest settings, the phone&#x27;s battery doesn&#x27;t really drain at all, can play for hours. Playing a Mono based game from the play store can drain the battery within 2 hours, and the games are usually so badly built for android, even paid games that have equivalents on steam.
    • littlecranky675 hours ago
      &gt; My dream would be that I can adb into my phone, install the .Net SDK or .Net Runtime (v 8 or 10) and have my applications run natively on Android<p>My understanding is that you can (almost) do that using MAUI (formerly known as Xamarin). You will not get a .Net SDK or Runtime, but the mono runtime. Since it is bundled in your app, you won&#x27;t actually notice.
      • BatteryMountain4 hours ago
        No, we need one level lower &amp; zero mono. I want the sdk or runtime to be installed in the same way (and executable) the same way on android as on other linux distro&#x27;s. .Net has ARM builds so it will work fine. This is without any specific framework dependencies (like aspnet, maui, avalonia etc) - just plain .net 8&#x2F;10. It would actually be nice if android just bundled the runtime to begin with so we don&#x27;t have to. They can just pin it to latest LTS versions and let it auto update now &amp; then, same way as WebView&#x2F;Google play services etc.
        • littlecranky674 hours ago
          So for whatever reason you want the .NET runtime over Mono - not sure why that is a hard requirement, but AFAIK that is also the goal for microsoft. As in, merging those runtimes and have a single codebase that works for all platforms (including android). There are technical obstacles and historic codebases, but I would expect this unified runtime soon.
  • LeFantome11 hours ago
    It blows my mind that Unity has not been able to migrate to .NET (CoreCLR) after starting back in 2018.<p>I would have estimated a year, or two tops, for that project.
  • skrebbel4 hours ago
    Does anyone on here know why it is that Unity doesn&#x27;t just run on .NET? The cross-platform benefits of Mono have disappeared a decade ago or something like that.<p>Like, why would Unity invest in hacks like il2cpp rather than just port over to modern .NET? Is there some licensing thing going on?
    • rincebrain2 hours ago
      The article touches on it - assuming it&#x27;s correct, it&#x27;s because they did a bunch of proprietary modifying on Mono, so it&#x27;s not &quot;just&quot; Mono any more, it&#x27;s Mono and a decade or more of the most exciting layer violating crimes you can imagine.<p>I would assume, if someone Meta scale had an app that had to be built on Unity for whatever reason, we&#x27;d see similar blogposts to the ones they did about finding bespoke optimizations for their Android app to be performant with how enormous it became, probably involving either some bespoke alternative to IL2CPP, or writing a bunch of bespoke optimizations onto a bastard descendant of whatever version of Mono Unity originally derives from and so supports...or just paying Unity so much money they get to do whatever they want to the underlying source.
      • tyleo1 hour ago
        I’ve heard (but don’t have an inside source) that Meta’s Horizon was built on Unity and then ported to a custom engine implementation.
  • sieep14 hours ago
    I recently started learning Godot and learning that they use .NET for the C# runtime is a nice touch. I write a lot of code that targets .NET in my day job, so having to learn the unity way of doing things would be frustrating.
  • MindSpunk9 hours ago
    CoreCLR doesn&#x27;t help on console platforms because you can&#x27;t ship the JIT runtime. To my knowledge CoreCLR&#x27;s AOT solution won&#x27;t work because of SDK and build requirements for shipping builds on consoles. I believe some consoles require that all shipped native code must have been compiled with the SDK compiler. Even if you fork the CoreCLR AOT system so you can build for the consoles (the code can&#x27;t be open because of NDAs) you wouldn&#x27;t be allowed to ship the binary. IL2CPP is the only path forward there. CoreCLR is only viable on PC.
    • CyanLite29 hours ago
      Simply not true, this info is outdated by a decade.<p>CoreCLR NativeAOT is already shipping real games on Nintendo, PS5, and Xbox.<p>JIT isn&#x27;t allowed on iPhones either, and this is what NativeAOT solves. Also, .NET is moving WASM support to CoreCLR (rather than mono) in an upcoming version as well.
      • MindSpunk8 hours ago
        Do you have examples? As far as I&#x27;m aware based on current info there&#x27;s at least one current console vendor that requires all native code to be generated by their SDK.
        • neonsunset8 hours ago
          Just don&#x27;t ship to PlayStation and discourage others until Sony changes (is forced to) policy.
          • pjmlp3 hours ago
            Capcom does, and they are quite happy with it.
    • pjmlp3 hours ago
      Yes, it does, Capcom is using it for their Playstation 5 games, like Devil May Cry.<p>&quot;RE:2023 C# 8.0 &#x2F; .NET Support for Game Code, and the Future&quot;<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=tDUY90yIC7U" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=tDUY90yIC7U</a><p>As always, it is a matter of having the skill to deliver, instead of GC phobia.
  • boguscoder14 hours ago
    Good article but seems strange that author benchmarked debug builds first, that’s a huge “no-no” in any perf tweaking and it’s clear that authors knows this well
    • iliketrains14 hours ago
      From my experience, performance gains seen in Debug builds in Unity&#x2F;C#&#x2F;Mono nearly always translate in gains in Release mode. I know that this is not always true, but in this context that&#x27;s my experience.<p>Setting up release benchmarks is much more complex and we develop the game in Debug mode, so it is very natural to get the first results there, and if promising, validate them in Release.<p>Also, since our team works in Debug mode, even gains that only speed things up in Debug mode are valuable for us, but I haven&#x27;t encountered a case where I would see 20%+ perf gain in Debug mode that would not translate to Release mode.
    • mort962 hours ago
      I agreed with you initially, but is it really as big of a deal in C#? I&#x27;m used to compiled languages where &quot;debug build&quot; means &quot;no compiler optimisations&quot;, aka every operation done with a variable is a memory load + store, trivial functions aren&#x27;t inlined so even trivial accessors called in a loop carry function call overhead, etc etc. But this is C#, so the JIT presumably optimises just as much in a debug build as in a release build?<p>So in C++ terms, it&#x27;s really just benchmarking &quot;-O2&quot; instead of &quot;-O2 -DNDEBUG&quot;. This seems fine.
  • enbugger3 hours ago
    Not to mention the Hot Reload which comes out of the box.
  • Rochus15 hours ago
    That&#x27;s interesting. I made measurements with Mono and CoreCLR some years ago, but only with a single thread, and I came to the conclusion that their performance was essentially the same (see <a href="https:&#x2F;&#x2F;rochus.hashnode.dev&#x2F;is-the-mono-clr-really-slower-than-the-coreclr" rel="nofollow">https:&#x2F;&#x2F;rochus.hashnode.dev&#x2F;is-the-mono-clr-really-slower-th...</a>). Can someone explain what benchmarks were actually used? Was it just the &quot;Simple benchmark code&quot; in listing 1?
    • to11mtm14 hours ago
      I think a lot of the devil is in the details, especially when we look at NET8&#x2F;NET10 and the various other &#x27;boosts&#x27; they have added to code.<p>But also, as far as this article, it&#x27;s noting a noting a more specific use case that is fairly &#x27;real world&#x27;; Reading a file (I&#x2F;O), doing some form of deserialization (likely with a library unless format is proprietary) and whatever &#x27;generating a map&#x27; means.<p>Again, this all feels pretty realistic for a use case so it&#x27;s good food for thought.<p>&gt; Can someone explain what benchmarks were actually used?<p>This honestly would be useful in the article itself, as well as, per above, some &#x27;deep dives&#x27; into where the performance issues were. Was it in file I&#x2F;O (possibly Interop related?) Was it due to some pattern in the serialization library? Was it the object allocation pattern (When I think of C# code friendly for Mono I think of Cysharp libraries which sometimes do curious things)? Not diving deeper into the profiling doesn&#x27;t help anyone know where the focus needs to be (unless it&#x27;s a more general thing, in which case I&#x27;d hope for a better deep dive on that aspect.)<p>Edited to add:<p>Reading your article again, I wonder whether your compiler is just not doing the right things to take advantage of the performance boosts available via CoreCLR?<p>E.x. can you do things like stackalloc temp buffers to avoid allocation, and does the stdlib do those things where it is advantageous?<p>Also, I know I vaguely hit on this above, but also wondering whether the IL being done is just &#x27;not hitting the pattern&#x27;. where a lot of CoreCLR will do it&#x27;s best magic if things are arranged a specific way in IL based on how Roslyn outputs, but even for the &#x27;expected&#x27; C# case, deviations can lead to breaking the opt.
      • Rochus13 hours ago
        The goal of my compiler is not to get out maximum performance, neither of CoreCLR nor Mono. Just look at it as a random compiler which is not C#, especially not MS&#x27;s C# which is highly in sync and optimized for specific features of the CoreCLR engine (which might appear in a future ECMA-335 standard). So the test essentially was to see what both, CoreCLR and Mono, do with non-optimized CIL generated by not their own compiler. This is a legal test case because ECMA-335 and its compatible CLR were exactly built for this use-case. Yes, the CIL output of my compiler could be much more improved, and I could even get more performance out of e.g. CoreCLR by using the specific knowledge of the engine (which you cannot find in the standard) which also the MS C# compiler uses. But that was not my goal. Both engine got the same CIL code and I just measured how fast it run on both engines on the same machine.
    • eterm15 hours ago
      What&#x27;s going on with the Mandelbrot result in that post?<p>I don&#x27;t beleive such a large regression from .NET framework to CoreCLR.
      • to11mtm14 hours ago
        NGL would be nice if there was a clear link to the cases used both for OP as well as who you are replying to... Kinda get it in OP&#x27;s case tho.
        • Rochus35 minutes ago
          I measured the raw horsepower of the JIT engine itself, not the speed of the standard library (BCL). My results show that the Mono engine is surprisingly capable when executing pure IL code, and that much of the &#x27;slowness&#x27; people attribute to Mono actually comes from the libraries, not the runtime itself.<p>In contrast, the posted article uses a very specific, non-standard, and &quot;apple-to-oranges&quot; benchmark. It is essentially comparing a complete game engine initialization against a minimal console app (as far as I understand), which explains the massive 3x-15x differences reported. The author is actually measuring &quot;Unity Engine Overhead + Mono vs. Raw .NET&quot;, not actually &quot;Mono vs. .NET&quot; as advertized. The &quot;15x&quot; figure comes very likely from the specific microbenchmark (struct heavy loop) where Mono&#x27;s optimizer fails, extrapolated to imply the whole runtime is that much slower.
  • LarsDu887 hours ago
    Ah I wonder if this could&#x27;ve saved me countless hours of optimizing my VR game Rogue Stargun for the Quest 2, particularly the final battle in the game
  • calebh15 hours ago
    Will the move to CoreCLR give any speed ups in practice if the release build is complied with IL2CPP anyway? On all the games that I&#x27;ve worked on, IL2CPP is one of the first things that we&#x27;ve enabled, and the performance difference between the editor and release version is very noticeable.
    • Rohansi14 hours ago
      Editor is slower than Mono release builds. You&#x27;ll need to compare Mono release vs. IL2CPP release to see the actual difference.
      • calebh13 hours ago
        I guess it would be good to also see a comparison between IL2CPP and Core CLR by the post author!
  • NooneAtAll35 hours ago
    my main problem with Unity games is never the speed - it&#x27;s the outrageous RAM usage
  • pwdisswordfishy13 hours ago
    The author (probably unknowingly) glosses over a lot in these sentences of the &quot;How did we get here&quot; section:<p>&gt; <i>Unity uses the Mono framework to run C# programs and back in 2006 it was one of the only viable multi-platform implementations of .NET. Mono is also open-source, allowing Unity to do some tweaks to better suit game development.</i> [...] <i>An interesting twist happened nearly 10 years later.</i><p>Not mentioned is that Mono itself of course improved a lot over the years, and even prior to MS&#x27;s about-face on open source, it was well known that Unity was hindered by sticking with an old and out-of-date Mono, and they were <i>very</i> successful at deflecting the blame for this by throwing the Mono folks under the bus. Any time complaints about game developers&#x27; inability to use newer C# features came up, Mono&#x2F;Xamarin would invariably receive the ire* because Unity couldn&#x27;t come to an agreement with them about their license and consulting fees. (Mono was open source under LGPL instead of MIT licensed at the time, and Unity had initially bought a commercial license that allowed them exemptions from even the soft copyleft provisions in the LGPL, but the exemption was limited and not, for example, for any and all future versions, too, indefinitely.) Reportedly, they were trying to charge too much (whatever that means) for Unity&#x27;s attempts to upgrade to the modern versions.<p>It&#x27;s now 10+ years later, and now not only Mono (after being relicensed under MIT) but .NET CoreCLR are both available for Unity at no cost, but despite this it still took Unity years before they&#x27;d upgraded their C# language support and to a slightly more modern runtime.<p>Something else to note: Although, LGPL isn&#x27;t inherently incompatible with commercial use or even use in closed source software, one sticking point was that some of the platforms Unity wished to be able to deploy have developer&#x2F;publisher restrictions that are incompatible with the soft copyleft terms in the LGPL that require that users (or in this case game developers) be allowed to relink against other versions of the covered software (including, for example, newer releases). Perversely, it&#x27;s <i>because</i> Unity sought and obtained exemptions to the LGPL that both end users and game developers were hamstrung and kept from being able to upgrade Mono themselves! (It wouldn&#x27;t have helped on, say, locked down platforms like Nintendo&#x27;s for example, but certainly would have been viable on platforms without the first-party restrictions, like PC gaming or Android.)<p>By now, Unity has gone on to pull a lot of other shenanigans with their own pricing that seems to have sufficiently pissed off the game development community, but it should still not be forgotten when they were willing to pass the blame to an open source project over the development&#x2F;support that the company felt it was entitled to for a price lower than they were told it would cost, and that they themselves were slow to make progress on even when the price of the exemption literally became $0.<p>* you can find threads with these sorts of comments from during this period right here on HN, too, but it was everywhere
    • littlecranky676 hours ago
      &gt; it was well known that Unity was hindered by sticking with an old and out-of-date Mono, and they were very successful at deflecting the blame<p>So much this. According to a 2023 blog article from Unity [0], Unity uses Boehm GC. But Mono itself introduced another, generational GC called SGen [1] more than 10 years ago that became the default at some point. It is just Unity stuck on old mono versions, missing out on all the changes and improvements that went into Mono after their fork, essentially.<p>[0]: <a href="https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;porting-unity-to-coreclr" rel="nofollow">https:&#x2F;&#x2F;unity.com&#x2F;blog&#x2F;engine-platform&#x2F;porting-unity-to-core...</a> [1]: <a href="https:&#x2F;&#x2F;www.mono-project.com&#x2F;docs&#x2F;advanced&#x2F;garbage-collector&#x2F;sgen&#x2F;working-with-sgen&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.mono-project.com&#x2F;docs&#x2F;advanced&#x2F;garbage-collector...</a>
      • rincebrain2 hours ago
        A sibling comment [1] remarks that they play games with raw pointers that are incompatible with the newer GC, so it&#x27;s not &quot;just&quot; an older runtime that&#x27;s biting them in the ass.<p>[1] - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46415568">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46415568</a>
  • darig11 hours ago
    [dead]
  • Rohansi13 hours ago
    [flagged]
  • Inityx15 hours ago
    [flagged]
    • llmslave215 hours ago
      You think? Seems human to me...
      • yunnpp12 hours ago
        It&#x27;s not AI, here&#x27;s why: (yup, LLM-style pun intended)<p>1. Uses &quot;I&quot;<p>2. Look how many times it switches verb tenses here:<p>&quot;One day I was debugging an issue in map generation and it was time-consuming [...]. To make debugging faster, I’ve written a unit test, hoping to cut down on the turn-around time since Unity takes 15+ seconds just to crunch new DLLs [...]. When I ran the test, it finished in 40 seconds.&quot;
        • CodeCompost7 hours ago
          It&#x27;s called a grammar mistake. People make them all the time, that&#x27;s why editing is a job.