blug/site/awful_software/unity-on-linux.html

91 lines
5.1 KiB
HTML
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>something silly - unity-on-linux</title>
<link rel="stylesheet" href="/style.css">
<link rel="icon" type="image/x-icon" href="/creacher.png">
</head>
<body>
<main>
<h1 id="unity-on-linux">unity on linux</h1>
<p>
<code>2024-08-03</code><br>
It's terrible. Sometimes it works, sometimes not.<br>
</p>
<p>
I got a flash of inspiration to make some shader art for ChilloutVR. I have done this a bunch before, but not in almost a year now. I found out why.<br>
</p>
<p>
Unity <code>2021.3.23f1</code> is the recommended version for the ChilloutVR <a href="http://documentation.abinteractive.net/cck/setup/">CCK (Content Creation Kit)</a>, so that's what I tried to use. It was getting about halfway through the asset loading before just freezing until I killed it. Looking in the logs revealed that the last thing it did was call <code>bee_backend</code><br>
</p>
<p>
I found <a href="https://discussions.unity.com/t/linux-editor-stuck-on-loading-because-of-bee_backend-w-workaround/854480">this forum post</a> with the exact same issue and a workaround! This is quite rare. I added <a href="./bee_backend_workaround.txt">the script</a> as instructed and the issue <em>changed</em>, wohoo...<br>
</p>
<p>
It was still crashing every time, but now because of a segmentation fault (SIGSEGV).<br>
<em>Sometimes</em> it would produce a stack trace after, saying that the editor died while trying to change graphics tier.<br>
</p>
<pre>
Caught fatal signal - signo:11 code:1 errno:0 addr:(nil)
Obtained 6 stack frames.
#0 0x007afe7cd5d1d0 in __sigaction
#1 0x0059982af74663 in OnGraphicsTierSwitched()
#2 0x0059982bd49070 in ApplyBuildTargetSwitchInternal(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#3 0x0059982bd4844b in SwitchActiveBuildTargetForEmulation(BuildTargetPlatformGroup, BuildTargetPlatform, int, bool, bool)
#4 0x005998296f6a73 in EditorUserBuildSettings_CUSTOM_SwitchActiveBuildTargetAndSubtarget(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#5 0x00000041703f61 in (wrapper managed-to-native) UnityEditor.EditorUserBuildSettings:SwitchActiveBuildTargetAndSubtarget (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int)
Launching bug reporter
</pre>
<p>
(the bug reporter did not launch most of the time)<br>
</p>
<p>
So I updated unity to <code>2021.3.<strong>41</strong>f1</code>, since it's LTS it should still be compatible with the CCK.<br>
I had to apply the bee_backend fix again<br>
The only change was that the stack traces were deeper, revealing the real source of the issue:<br>
</p>
<pre>
Obtained 12 stack frames.
#0 0x007e9b1f75d1d0 in __sigaction
#1 0x0059b44681c233 in OnGraphicsTierSwitched()
#2 0x0059b4474b29f0 in ApplyBuildTargetSwitchInternal(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#3 0x0059b4474b1dcb in SwitchActiveBuildTargetForEmulation(BuildTargetPlatformGroup, BuildTargetPlatform, int, bool, bool)
#4 0x0059b444e61693 in EditorUserBuildSettings_CUSTOM_SwitchActiveBuildTargetAndSubtarget(BuildTargetPlatformGroup, BuildTargetPlatform, int)
#5 0x000000414635f0 in (wrapper managed-to-native) UnityEditor.EditorUserBuildSettings:SwitchActiveBuildTargetAndSubtarget (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget,int)
#6 0x00000041463407 in UnityEditor.EditorUserBuildSettings:SwitchActiveBuildTarget (UnityEditor.BuildTargetGroup,UnityEditor.BuildTarget)
#7 0x0000004145d96f in CCK_Init:.cctor ()
#8 0x0000004145dc7e in (wrapper runtime-invoke) object:runtime_invoke_void (object,intptr,intptr,intptr)
#9 0x0000004116eef5 in (wrapper managed-to-native) System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (intptr)
#10 0x0000004116ee47 in System.Runtime.CompilerServices.RuntimeHelpers:RunClassConstructor (System.RuntimeTypeHandle)
#11 0x0000004116e753 in UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes (System.Type[])
#12 0x00000041128805 in (wrapper runtime-invoke) <Module>:runtime_invoke_void_object (object,intptr,intptr,intptr)
Launching bug reporter
</pre>
<p>
<code>CCK_Init:.cctor ()</code>, the CCK init constructor.<br>
</p>
<p>
That's just a c# script. I can edit those.<br>
I deleted the whole constructor, and now unity launches, incredible.<br>
Obviously it is there for a reason though, but luckily there was a much newer version of the CCK (<code>3.10</code> instead of <code>3.5</code>), and after installing that, the editor still seems to be working correctly.<br>
</p>
<p>
I wasted like an hour fixing this, and my inspiration is long gone, but at least I can make something next time.<br>
</p>
<p>
The reason I hadn't done anything since september was that i had to update to unity 2021 from unity 2019, and it didn't work on linux. I did some stuff in my windows VM but ultimately it's too annoying to work in so it put me off content creation until now.<br>
</p>
<p>
Even though chillout caused the crash, I'm pretty sure this is unity's fault. The linux editor has always been flaky and I feel like a user c# script shouldn't cause segfaults in the editor that easily.<br>
</p>
<p>
<a href="/">back home</a><br>
</main>
</body>
</html>