The portfolio of a gamer, programmer, and musician.

July 2, 2017July 2, 2017

Unity3D Serial Component Controller

After a looooooong break, I have mustered the time to actually complete a small project that I had thought of for a while.

Wouldn’t it be great if one could change the values of some Unity components attached to object, in a less fiddly manner? Whenever you are playing your scenes in the Unity Editor, if you want to change some values like the height of your hero, or the speed at which the enemy ships cruise in on you, there is quite a bit of back and forth to be done between the elements in the scene hierarchy.

This was the initial rationale behind this proof of concept project.

For this, I grabbed my dusty old (but still functioning) mbed lpc1768 from arm (which is a gread micro-controller I must say!), put it on a testing board alongside with some potentiometers, and started working on it.

The idea is that you can grab any object from your scene hierarchy, drag and drop it into the designated field, and a custom inspector script will automagically find the transform component of your object. Once this is done, you can use the three potentiometers to change the X, Y, and Z scale dimensions as you please.

For the future, I think what needs to be done is to let the user choose which component values should change. I don’t want to limit this to the transform.scale. Another thing is to get different potentiometers, some which let me add/subtract to the values until infinity. These ones just let you increment by one full turn, which is a bit limiting.

You can find the code here: https://bitbucket.org/joaopccosta/potentiometerinspector