Tag Archives: Unity

Fixing Unity3D Hub on Fedora

Unity3D isn’t officially supported on Fedora, only RHEL & Centos. It will work fine, it just needs a little tweak.

You can install Unity Hub by following the instructions for RHEL/Centos here: https://docs.unity3d.com/hub/manual/InstallHub.html#install-hub-linux

After doing so, you’ll probably get a blank screen:

Unity Hub Blank

If you run Unity Hub from the console you’ll see the following error:

ERROR: Licensing SDK logging callback is not registered. Please use 'registerLoggingAdapter' function from the SDK to do
so.
If you try running the licensing SDK directly you'll get this error:
/opt/unityhub/UnityLicensingClient_V1/Unity.Licensing.Client
No usable version of libssl was found
[1]    694717 IOT instruction (core dumped)  /opt/unityhub/UnityLicensingClient_V1/Unity.Licensing.Client

You can see from the error that Unity is looking for an older version of SSL that is present on RHEL/Centos systems, but not newer version of Fedora.

To fix this, just install a compatibility version of SSL and kill any running versions of Unity Hub

sudo dnf -y install openssl1.1 && killall -9 unityhub-bin

Once that’s done, Unity Hub should work as expected!
If you’re still having trouble, a full reboot should do the trick.

Fix for Android SDK Errors in Unity on Linux

When I add Android support for Unity on Linux as an additional module in Unity Hub, I find that Unity is unable to the SDK.

The problem appears to be that Unity does not set the binaries included as executable after extracting. I believe this may be fixed on newer versions of the Editor, but this is an issue for me on 2020.3.28f1.

The simple fix is to make all files in the AndroidPlayer executable. If Unity is open, close it.

Open Konsole or another terminal app.

cd ~/Unity/Hub/Editor/[Unity version]/Editor/Data/PlaybackEngines/AndroidPlayer
find . -type f -exec chmod +x {} \;

When you re-launch Unity, it should have no problem using the Android SDK.

VS Code Namespace Not Found With New Unity Input System

If you’re switching to the new Unity Input System and using Visual Studio code, you’ll probably hit the hiccup I did.

After switching back-ends, you’ll find that you’re not able to use the new namespace. If you try, you’ll get “namespace not found.”

using UnityEngine.InputSystem;

To fix this, you’ll simply need to create the csproj file so VS Code knows to use the new assembly.

In Unity Editor go to Edit->Preferences
Choose “External Tools”
Click the “Regenerate project files” button

After that, VS Code should recognize the new UnityEngine.InputSystem namespace!

New UI Prefab Scaling Solution

I recently changed the settings on my UI Canvas from “Screen Space – Overlay” to “Screen Space – Camera”. Which is how I’m sure it was supposed to be done in the first place (n00b here).

Anyway, in doing so, all of my UI prefabs were coming in scaled to 53.3333%.

I did a quick hack using a script to set those back to 1, but I figured there must be an elegant solution.

I finally found the (so, so simple) solution in the Unity forums.

When instantiating a prefab into the UI, you need to add the “false” argument when setting the parent.

Use

GameObject obj = (GameObject)Instantiate (prefab);
obj.transform.SetParent (parent.transform, false);

 

NOT

GameObject obj = (GameObject)Instantiate (prefab);
obj.transform.SetParent (parent.transform);