I want to be able to click on a game object (or a person) and have it open up a dialog window. i have no idea how to do that and i have been searching online for hours and no one asked this question. if you can, could you please help me.
If your object has colliders it easy,
just use
bool clicked = false;
void OnMouseUp()
{
clicked = true;
}
void OnGUI()
{
if (clicked)
{
GUI.Box(new Rect(20, 50, 100, 40), Box)
if (GUI.Button(new Rect(10, 50, 50, 20), Close))
clicked = false;
}
}
Attach this to your object.
Position of GUI elements will probably need changing.
Your Gameobject needs to have a collider. Then you can put whatever code you need in the method OnMouseDown() (triggers when a mouse button is clicked down while over the objects collider), or OnMouseUp() (feels more natural when detecting clicks).
more info on the Mouse events:
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.html
if you need more control, you can do a raycast:
http://unity3d.com/support/documentation/ScriptReference/30_search.html?q=raycast
The dialog stuff you have to do in the OnGUI() method:
http://unity3d.com/support/documentation/ScriptReference/MonoBehaviour.OnGUI.html
I would go into more detail, but don’t have much time. The scripting reference is always a great resource. Also, search YouTube, there are some great video tutorials there.