How to start a dialogue when you walk up to a game object?

Amateur with Unity here. Just wondering how to make it so that when my character walks up to a particular game object, the dialogue will commence. I have already figured out how to create dialogue.


Part of the orginal post: You could add a box collider as trigger as a child of your character, and add another trigger to the gameobject that has the dialog.

Edit 2 (sortof):

I would put a dialogueinstance.js script on every person you should be able to talk to, and then remove the checkmark in front of "Dialogue Instance (Script)" in the inspector.

You will have to name your main character "Player" in the Hierarchy.

Add this script to every person you should be able to talk to: (and in the inspector, drag the "Dialogue Instance (Script)" to where it says "None (Dialogue Instance)"

var dialogue : DialogueInstance;
var endOnExit : boolean = true;
function OnTriggerEnter( collider1 : Collider )
    if ( == "Player" )
        dialogue.enabled = true;

function OnTriggerExit( collider1 : Collider )
    if ( == "Player" && endOnExit)
        dialogue.enabled = false;