Tag Archives: Unity

Unity Tips and Other Tidbits

Hey, everyone!

I want to talk about a few very simple tips for debugging problems in Unity (be it scripts or other things) and some other cool stuff I’ve been doing besides homework.

Simple Debugging Tips:

1.  Is your script not working/running?  Check to see that the script is on the object you are expecting it to be on or see if the script is enabled (the check-box is checked) on that object.  This is probably the most basic problem a Unity developer can have and not realize until a good amount of time has been wasted (trust me, I’ve done this as well as other teammates).

2.  Try not to move files around in the folders outside of the Unity project.  Instead, move them around inside the Unity project and it will help prevent problems.

3.  You changed the name of a script and now you are getting an error.  This fix is simple: Rename the class inside the file to the new name of the script.  Unity is looking for a class inside that file with the file name.  I’ve done this a few times and it’s a very easy fix.

4.  Do not have scripts with the same names!  This is primarily due to duplicate scripts entering your Unity project.  Unity is helpful and won’t let you create a script with the same name.  My previous game team had this problem and spent a very large amount of time trying to figure out this dastardly error.  I also solved this problem for an instructor at school.  This is caused by not following tip 2.

5.  This last tip is very easy: If you can’t figure out what your problem is by yourself and have already sought help from others around you, search Google.  Unity has been around for a fair amount of time now and the chances are that someone has already encountered your problem and learned how to fix it.  These solutions usually come from the Unity forums.  If your problem can’t be found, then go ahead and ask away on the forums, because there will be people there who want to help.

6.  Okay, one last tip:  You can live debug your scripts using MonoDevelop by running your game and then, inside MonoDevelop, click on the Run tab, click Attach to Process…, select the Unity Editor process, and click Attach.  Any breakpoints put in your scripts will then be hit and you can feel free to step through your code.  I have yet to figure out how to do this using Visual Studio 2010, but plan to do so.

Time for those tidbits I’ve been working on:

I’ve been reading up on hierarchical pathfinding lately because I have an idea I want to use it for.  I’ve been reading this in Artificial Intelligence for Games.  It’s a good book.  And after reading that I had all sorts of ideas on how to make an editor in Unity to edit a graph for nodes.  Since I haven’t done any work to make a custom editor, I started researching and made my very first editor window (even if it was the example window from the reference manual).

And some non-video game related stuff, I finished painting my gnome miniature for my new Pathfinder character:

Gnome Summoner
Gnome Synthesist Summoner

He’s a gnome sorcerer miniature with the flames cut off.  The flames went from the tip of the dagger, over his head, and to his left hand.

Thanks for reading and I hope the tips help!