It has been a while since I wrote something new here, but I have been quite busy due to new life projects that started and (hopefully!) will go on in the next years.
Why am I writing this post? In the last week I have been struggling trying to refresh some Unity knowledge, trying to remove some dust and making things works. Even before start working, I faced some issues with the engine itself that made me lose a lot of valuable time – I hope that sharing with you will avoid you loosing that time as well!
A little promise to myself. In the next weeks – even months – I will hopefully gain a more in depth knowledge about the engine and related topics, like 3D modelling, so I am going to share more posts about how to work better with the features proposed by the engine. For now, let’s focus on how make it work without issues.
Be careful when using VPN and Unity
This is an issue that made me lose a lot of time! For some reasons, Unity does not like VPNs. Unfortunately, the engine does not provide an error clearly stating its incompatibility, but it randomly crashes. I suspect that it has to do with online license checking, because a lot of people that use PC for malicious intents connect to the Internet using a VPN, so they make the assumption that if you are connecting through a VPN you have something to hide.
By the way it is easy to spot when this happens. The engine will crash:
- When you load a new project
- If you were lucky and the project loaded correctly, it will crash when you try to run the project using play
Some examples of the random crash screens I received when trying to use Unity with a VPN turned on:
Close Unity when you first upload your project to GitHub
Another silly issue that made me lose a huge amount of time. Usually, when you work with a VCS (“Version Control System”) like GitHub, you are allowed to keep your source code opened in your IDE. This is one of the most common use case. Unity is not an exception, but it creates some silly mistake only if you are initialising a new git project and you are committing your code to your new repository.
If you are in this scenario, you will start having some issues when you are pushing your code to the server. You will first receive some complaints about LFS, asking you to turn it off in order to send correctly your source code, and then it will start raising some “Permission denied” (exit status: 255). Here the full error string:
batch request: firstname.lastname@example.org: Permission denied (publickey).: exit status 255
This is quite funny because it has nothing to do with LFS or unauthenticated public key, and this is where comes from the huge amount of time lost!
Just for the sake of completeness, i write a few lines about what is LFS. This stands for “Large File Storage“, and it is the tool that git uses to store big files. Those files are not stored with other files, they are stored somewhere else, and git keeps only a link to them. When uploading a Unity project you are using LFS because typically they contain a lot of files! Important: don’t forget to include the “.gitignore” file provided by GitHub, designed for Unity project. This will allow you to have a more clean repository.
Lastly, a few lines telling you how to add an existing project to git (remember to replace your own personal URL at line 4):
git init git add -A git commit -m 'Initial version' git remote add origin email@example.com:yourusername/this-is-your-personal-slug.git git pull git push
Those were some useful hints about common problems with uncommon error messages, typically the hardest to debug and troubleshoot. For other errors, always remember to read carefully the error message as it usually contains the solution to the problem. If you are looking for more tips on using git, don’t forget to read this blog post: Git: 5 useful pills.