Skip to main content

Posts

Unity Best Practices for Beginners

Unity is a fabulous tool for not only games but also interactive entertainment, simulations, etc. And there are many good tutorials on tips and tricks to optimize performance and code readability. I compiled this list as a memo to myself when starting out on Unity, so I can always refer back to the basics and hoping that this can help someone else too. Object pooling. Object pooling is a pretty cool trick and it improves performance because you can reduce the number of Initiate() and Destroy() calls. To illustrate why Destroy can be bad, I attached a screenshot of a project I was building with Unity. I'm not going to go into the details of Object Pooling because there are already many good tutorials out there. One of them being this one.  One thing to always keep in mind is that it is easy to get MissingReferenceException if you accidentally Destroy() the pooled objects. It happened to me once where I attached one script to multiple prefabs which behave the same except that so...

URG センサーとWindows 10

個人メモ。しばらくWindows 8 でURGセンサを使っていたが、新しいPC に開発環境を構築することになった。そして、Visual Studio を入れたらVisual Studio 2017 に新しくなった! とりあえず ここから URGライブラリをダウンロード。 解凍してビルドしたらエラー。ビルドターゲットは古いWindows SDKに設定されているようだな。ソリューションを右クリック、「ソリューションを再ターゲット」を選択する。そしたらもう一度ビルド。今回はうまくいった! Debug とRelease 両方ビルドすることをお忘れなく。

OpenCV Quickstart on Windows

So after about 7 years I recently started playing around with OpenCV again. It really has come a long way especially on how it distributes binaries and libraries. I still remember the old days when building on Linux was hard but possible whereas Windows was short of impossible. Well it seems that has all changed ! After struggling to build this new version of OpenCV for about 2 days I decided to share it here for my own memo and hopefully it can also help others who need it. This is heavily based on  this tutorial . Let's dive in. First things first. We need to make sure we have a similar build environment. Windows 10 Visual studio express 2015 Opencv 3.1 Dependencies  : Just choose what you need. Step 1 Download OpenCV executable  here . You will find it in your Downloads folder. Run it and you will get an opencv folder. Feel free to move it around to any path you like. Let's assume it is in {opencv_dir}. In my case, as you can see from the screenshot, I m...

Convert MP4 videos to MP3 audio files

I wanted to listen to some recordings of foreign language study courses but they were available only as MP4 videos. And when you play them on your phones or tablets, they will be paused if you navigate away from the screen. It's video. You need to be looking at it for it to play. But I wanted to listen to them during my commute, which means I need to be walking and not staring at the screen the whole time. I looked for ways to workaround the video-gets-paused limitation but I found that converting it to mp3 is fast, and doesn't cost a penny. First, to share the script. I keep it here . Copy as zip, or clone the converter script from the link above. Go to the folder "mp4-mp3-converter and confirm that you have the file convert.bat inside. For Windows, download FFMPEG here . Save the ZIP file and unpack it. Let's assume you unpacked it on the desktop. You will see a folder with a name that looks like :  ffmpeg-2016xxxx-{some-numbers}-win64-static, the fol...