Website may be up and down over next few months. I'm currently doing a complete overhaul of everything. Going back to simple individual .htm pages, new overall site theme, sanitizing and cleaning up html of all pages and blog posts, attempting to implement a new tooling and publishing system etc etc.

With scripting you can add menu items that have shortcut keys assigned to them. Read the MenuItem description for more information.


A great way to help debug your game is to use Gizmos to visually represent empty game objects in your scene.

Check out BurgZergArcade's youtube channel with over 200+ unity tutorial videos.


Unity 101 Tip #15 - Tags

Published 7/10/2012 by createdbyx in News | Programming | Unity

 When working with multiple duplicate game objects you may want use tags to uniqely identify a specific object.  You can then use GameObject.FindGameObjectsWithTag to select that specific object in your scripts.


If you need to output information to the unity console check out the Debug class.


If you need to set the screen resolution of your game via scripting check out Screen.SetResolution.


To allow the user to undo actions that are performed by a custom editor script you can use Undo.RegisterUndo

foreach (var item in Selection.transforms)
{
    Undo.RegisterUndo(item, "Move " + item.name);
    var pos = item.position;
    pos = new Vector3(activeObject.transform.position.x, pos.y, pos.z);
    item.transform.position = pos;
}

If you want to take advantage of functionality that is provided my menu commands you can use EditorApplication.ExecuteMenuItem in your editor scripts to execute them.


Are you working on a large project but dislike how many objects you have to weed through in the hierarchy window? You can create editor scripts that change the objects Object.hideFlags property to hide or show the object in the hierarchy window.

var item = Selection.activeGameObject;
if ((item.hideFlags & HideFlags.HideInHierarchy) == HideFlags.HideInHierarchy)
{
                item.hideFlags = item.hideFlags ^ HideFlags.HideInHierarchy;
                item.active = !item.active;
                item.active = !item.active;
}

Notice that item.active = !item.active is specified twice. Currently in unity 3.5 you need those 2 lines of code for the game object to hide and show properly in the hierarchy window.


Wondering how to save player preferences across sessions or save settings for an editor script to use? Check out EditorPrefs & PlayerPrefs.


If you are writing custom editors for unity and you need to have a way of editing the tools settings you can have those settings show up in the Unity Preferences Window "Edit -> Preferences...".

Just create a new editor script that has a public class and add the fallowing lines of code ...

// Add preferences section named "cbxTools" to the Preferences Window
    [PreferenceItem("cbxTools")]
    public static void PreferencesGUI()
    {
        // Preferences GUI
        cbxToolPreferencesConfig.Instance.DrawGUI();
    }


Created by: X

Just another personal website in this crazy online world

Name of author Dean Lunz (aka Created by: X)
Computer programming nerd, and tech geek.
About Me -- Resume