I’ve kept my eye open on Unity’s Linux progress for some time, and the less charitable of you out there could be forgiven for thinking that if the people writing Unity really believed in it, then they’d rewrite the editor in Unity itself…
After an initial look with Void Linux (some success but later versions failing to be able to use Void’s libSSL), I decided I’d meet the Unity dev’s halfway and installed the LTS version of Ubuntu, I’m also using a pre-release version of Unity (assuming this is where most of the work for Linux is taking place)
Unity Hub can be downloaded in the form of an AppImage and this dashboard is very convenient, allowing you to install various Unity versions and their modules (for example you can build a windows exe from Linux using the Windows build module). As my home directory has a development folder, the hub choose to install in a unity directory inside development, which I can live with! Installs are somewhat heavy weight coming in at 6GB – 8GB depending on which modules you have installed, actually more by far than the OS hosting it (On Linux at least!)
I started my tour of Unity by checking out a few of the interactive tutorials, and I have to say these make for a much easier introduction to Unity. Where previously tutorial text would lead you to go on a hunt for whatever property needed to be changed in the editor, with the interactive tutorials the property in question becomes highlighted, and this really helps you to learn the basics of the editor.
In short order I had doors opening and closing with switches in a scratch project. I created some prefab objects from simple models I created in blender, keeping objects separate in blender makes separate GameObjects in the assets hierarchy. A quick and easy way to make a switch is to then “tag” the switch sub object as “door-switch” (for example), from a mouse ray hit (in your player behaviour) its simple to pick up the instance of a door behaviour script when you hit a “door-switch” tag from the targets parent.
What I wasn’t prepared for was how in turn Unity’s UI is both infuriatingly simplistic and yet after significant fettling, capable of drag and drop interfaces (which you really need if you’re doing some kind of inventory) One big gotcha is to do with firing UI events. To fire an event the “On” property (for example On Click) need initially an instance of a script, note here an instance so you need to drag a GameObject that has scripts attached first.
The real gotcha here is the editor will happily allow you to drag an actual script into the property, this doesn’t work and doesn’t create any kind of error or warning, when you do drag a GameObject into the event, the text input next to it becomes a dropdown allowing you to call a method on that script.
I spent rather longer on this than I’d have liked, and only after extensive use of DuckDuckGo did I discover a single post, in a host of unrelated issues people were having…
So if anyone else has difficulty with “Unity UI events not firing” Hopefully they might find the above (rather quicker than it took me)
Of course like many other things, once you stop and think about it, a script in unity on its own, really isn’t much use. Its only once a script is attached to a GameObject and it gets instanced, that it then has somewhere to store its properties, for example a box prefab might need to access an inventory instance from a player, make a public field in a script of the appropriate type and it becomes visible in the editor, you can take this as far as lists of specific types meaning a boxes inventory items are directly settable from the Unity editor, nice….
So what’s verdict, well its easy to knock something as large and flexible as Unity, but you know what you can get real results really very quickly. In terms of how it works in Linux, well I have to say it works really well, testing your application in the editor it works in a very consistent way to either a native (Linux) build or a Windows build even a WebGL build. The only real issue I’ve had with Unity have been well… Unity specific issues not Unity on Linux issues. So if you’re interested in game creation and don’t happen to own Windows, you should probably give it a go…