Just recently I’ve been attempting to debug custom DLL’s in Unity with Visual Studio.
After a bit of fooling around with pdb2mdb.exe as it is mentioned in the Unity documentation I came across a little gem in the Visual Studio Tools for Unity (VSTU) documentation, there it mentions that VSTU automatically generates an MDB from the PDB file, so i figured now that VSTU is integrated in Unity it should happen automatically.
And indeed Unity can automatically convert the PDB file to an MDB file on import. Just copy the PDB file along with the DLL and unity will generate an MDB file automatically. Saves having to call pdb2mdb.exe yourself.
There you go another complexity saving tip from yours truly.
If anyone knows if this works on OSX aswell let me know.
Say you have a project with objects you don’t want in your final build. With unity you can go about this is a whole bunch of different ways.
You can add a script that can do a bunch of things like destroy the objects if it’s not running in the editor, or you could just simply disable the object.
Or if you want an unsafe and impractical method you could delete the gameobjects build the player and then undo.
Why go to all that trouble when you can just add the EditorOnly tag this causes Unity to not include these tagged gameobjects in the built player.
Without requiring even a single line of code. Ok, it’s possible you’ve already added a specific tag to your special gameobjects, then you just create an empty gameobject and give it the EditorOnly tag and hang your objects as child objects under it.
Yes folk… Yet Another Year has come to our door and by gosh aren’t we all looking forward to it. So it’s that time again where I post a yearly happy new year post and tell you all to enjoy it as much as you can, whether you do or not is entirely in your hands. Some of you may have the best of intentions for the new year others may not, either way I’m going to spill a few of my intentions for this year.
#1) More blog posts. Eventually this is for me, myself and I, we’d all like to have a blog with more than just happy new year posts.
#2) Will continue posting unity tips & tricks
#3) will probably have some parenting related posts in the future
#4) Did I say more blog posts?
If I have any more great idea’s I’ll be sure to write a post about it, although I’m not going to commit to a “I’ll post once a week” but there is a goal in there somewhere.
I’m gonna leave it a that for now Happy New Year and hopefully I’ll get back here with something useful to say.
Currently I’m working on a project at work that requires the information (lets call it unity content) displayed on twelve screens in another room/building (a long way away from the computer generating it), it’s a little bit of an unrealistic-solution/challenge to connect a dvi/hdmi/<or you name it> cable through buildings… as quality degrades the longer the cable gets… and not to mention all other obstacles along the way.
Enter streaming over ip… now this is not the easiest thing to do there are many ways to go about it.
The first option that came to mind was lets get a hardware adapter that can convert the DVI output to an H.264 IP stream.. that is a pretty expensive solution if you have twelveÂ outputs that need to go to twelve screens, average cost of a decent hardware encoder runs somewhere around and above 4000 euros that times 12 and you have yourself an expensive streaming setup..
So Ideally thinking about costs the best solution would be do it in software, the solution first thought of was to do screen capture and encoding on the fly, all possible with vlc and many other software screen capture programs. After a few small tests this proved to be really CPU hungry and not really the best solution, because we need as much CPU & GPU time as possible for generating the Unity Content.
So now almost at the end of all options a colleague of mine mentioned AMD’s Radeon Sky Series which is basically cloud gaming tech not yet available for the masses. This got me thinking and looking more closer at cloud gaming which is basically a server on the web streaming games to specialized clients. LookingÂ furtherÂ into this I found Nvidia and the new range of GPU’s with Kepler Architecture *hallelujah* each Kepler basedÂ card is fitted with a beautiful h.264 encoding chip. Which turns out to do encoding without even touching the GPU or CPU time, and mighty fast too… 76 frames at 600ms which boils down to about 8ms per frame Â which is what i’m looking for. with Low Latency settings I even got a 1.08ms encoding time… *jaw drop*
So I dove head first into theÂ reasonably clearÂ Nvidia API and expanded on my previous experience in creating a decent C++ native Unity Plugin. After bumping into alot of “unresolved external symbol” errors (which by the way usually mean your missing a lib file) and a few unicode/ascii hurdles (Yes i didn’t think this would be an issue, but it turns out C++ is picky about string encoding) I eventually got some output from the chip even though it was just a green screen.. it was still output and the encoder had been initialized to create it. Which meant progress!
Realizing that the green screen wasn’t my actual unity content I figured I’d better dig a little deeper and found that the green screen was actually blank YUV pixels, eventually I managed to change that to red using different YUV values and filling the texture with them. Still not so useful because Unity doesn’t output YUV pixels now does it. This led me to search the internet for a way to convert RGB to YUV (actually BGRA to YUV444) pixel for pixel conversion was an option with readily available formulas online.. only not the fastest way.
Browsing through the built-in shaders I found a reference to a YUV conversion, using that as a reference I created a new shader for myself to do the YUV conversion with some modifications to values and the order they are stored in.
Now a little under half a year later i’m using my plugin to encode 12 H.264 streams to send to VLC which passes it on to a VMS.
Video Will soon follow 😉
For all of those people out there with a wordpress site and a will to show some unity content. Here’s your chance to shine…
You can use the plugin below to do exactly that, glad to be of assistance.
Unity Media Plugin
Unity Media Plugin allows you to upload various Unity Engine related files to your WordPress site. It also allows you to add a Unity Webplayer to your post.
Major features in Unity Media 1.0 are:
- Uploading of FBX files, .unitypackages and .unity3d files
- Inserting multiple webplayers into your posts
You can download my plugin here:
u3dmedia.zip (1540 downloads)
1. Upload plugin zip to site
2. Activate plugin
3. You can now upload a .unity3d file
4. And place the following tag in a post to add a unity webplayer to it:
[UnityMedia src="<url of unity3d file>" width=550 height=344]
Let me know if you like this plugin or if you think it’s missing some important feature, your welcome to comment or donate so I can update it.
Inspired by a fellow ne2000-event goer http://juerd.nl/site.plp/kwh (dutch site) who made a kwh-meter-meter. I decided to also do something similar with my Arduino as it was just sitting idle in a box waiting for greatness…
To do such a project requires aÂ light amount ofÂ electronics experience, although you can probably do it without. If you know how to solder and you can tell the difference between positive and negative connections then bob’s your uncle.
Before I could get started on this project I needed a few more electrical components like resistors, more flashy leds and what not.Â I ended up searching the web for a decent place to order the components (which turned out to be Reichelt.de) and ordered the IR Sensor for the project from a local electronics shop in Utrecht because reichelt.de didn’t have it. Three days after ordering all the bits and pieces a package arrived and I could start.
I soldered the TCRT5000 sensor to a piece of soldering board because I didn’tÂ want to break any of its terminals fiddling with cables and such, plus it made for a better connection. Added the resistorsÂ and two leads for power to that piece of soldering board and then connected it up to the arduino read out the value and.. awesome it worked straight away.
After some tweaking of values I got a sensible reading from the Arduino for each cycle on my kWh meter. That was step one actually getting an event outside of the kwh-meter. Now the question was what to do with that.
In the example project that inspired me (juerd’s project) juerd had an OpenWRT router capturing values and storing them into an rrd file. As I dont have any OpenWRT or linux server I thought why not use Munin to monitor my Arduino output.
To accomplish this I used my Ethernet shield as a webserver to serve values to a custom made munin plugin (which was easy to make). That saved me a problem because I already had munin running on a server of mine.
In using munin I have a polling time of 5 minutes which is more than enough to see the amount of power going out, but it would mean that if something used an excessive amount of power in a time period of less than 5 minutes then I could potentially miss it. To fix this I added a variable that gets reset after each web request and holds the highest value: maxwatt. That allows me to see when short bursts occur in my power usage. But overall the 5min poll time is just fine.
Yes it’s fairly low-tech at the moment but hey come on.. it’s an arduino project.Â Project code can be foundÂ here
A Quick update that this project is still working..
It needed a slight adjustment because my provider hands out dynamic IP addresses, and the arduino lost track of its self after a while.
So I had to change the order of execution in the loop and also added some dyndns updating..
Here’s the latest day graph:
2012 has been a great year with a cherry on top… just before new years on the 27th my wife gave birth to our brand new daughter who is doing very well. This last year has been good, I got a permanent contract at work and we moved into our own house back in feb, all in all it’s been a rather eventful year. Of course the last few weeks have all been baby filled, now with things settling down and gradually getting in to the rhythm of broken sleep and changing diapers there is time in between to do grown up stuff.
What grown up stuff is there to be done? you may wonder?
Well I noticed a few things on my site that needed fixing so i’ve tended to that, you’ll now notice that all unity webplayers on the site should be working much better. Plus i’ve updated the theme template to the newest version. Not to forget updating wordpress which was well over due.
In the near future I’m playing with the idea to switch hosting as this is getting to be a little over the top for something not generating much in return. If your reading this now your welcome to donate if you like what I do here, or if you have any tips for me please comment.
I may offer some nice stuff to the Unity Community via the Asset Store once I’ve figured out what that could/should be. If you have any requests or ideas for what an experienced Unity Developer should make and you’d be willing to pay a nice sum for it let me know.
Other than all of that technical stuff, I’m looking forward to the remainder of 2013 and what it has to bring, as well as watching my daughter grow and build her character. I do hope everyone enjoys 2013 in good health and free of negative stuff, so.. for now I wish you all a happy new year!
Pro Tip: Don’t let the bed bugs bite and steer clear of smelly diapers.
Are you sick and tired of forgetting to copy that data file to the build directory after each and every standalone build in unity? Sure you could incorporate it into the project but you don’t want that, you just wish that PostProcessBuildPlayer script would work on windows. As of Unity 3.5.2 life just got better…
A long awaited function in Unity was a working post process build player script for standalone players on windows as it was already working on mac’s. As seen in the latest Release Notes and stated in the BuildPipeline a few things have changed.. Apparently the PostProscessBuildplayer script is not supported on windows, which is a bummer for windows users on the other hand it’s easily solved with a new and improved UnityEditor.Callbacks which is both usable on Windows and Mac, So here goes…
P.S. No this is not a custom build window script, it actually triggers from the existing Unity BuildWindow.
NB: -10 is a higher priority than 100, the default priority is 1
NB2: This is an Editor Script not something for a gameobject (you should know this)
You can use the method to do all kinds of things on your computer after a build is complete just a couple ideas:
- After a large build send an email with a link to the file saying the build is complete.
- Play a sound notifiying you build is complete
- Run a test on your build
- And lots more…
Anyway now you have the tools go make 🙂
A while back the guys at unity released a version of their editor with macros enabled (by accident) in the current version is has been removed/disabled. (this because it’s something they use for testing and not meant for production environments)
But with recent endeavours I found it’s possible to enable it in the editor making debugging stuff within the editor more entertaining, plus it adds a new window to the editor making your editor more of an editor.
Please note this is not documented by unity and probably not supported either.
How to use:
Place this script in an Editor directory in your Assets and then:
Go to Window->Macros and tadaa.. you have a new editor window that can record all your editor actions and execute new ones.
May this help you on your endeavors of making cool new stuff for unity