Exemplo n.º 1
0
    public static bool OnOpenAsset(int instanceID, int line)

    {
        //Get the instanceID of the DialogueGraphContainer to find it in the project.
        string            assetPath = AssetDatabase.GetAssetPath(instanceID);
        DialogueContainer dgc       = AssetDatabase.LoadAssetAtPath <DialogueContainer>(assetPath);

        if (dgc != null)

        {
            //Debug.Log($"Opening graph \"{dgc .name}\"");

            DialogueGraph window = GetWindow <DialogueGraph>();

            window.titleContent = new GUIContent($"{dgc.name} (Dialogue Graph)");

            //Once the window is opened, we load the content of the scriptable object.
            //Even if the new name doesn't show up in the TextField, we need to assign the _fileName

            //to load the appropriate file.
            window._fileName = dgc.name;
            window.RequestDataOperation(false);
            return(true);
        }

        //If object not found, won't open anything since we need the object to draw the window.
        return(false);
    }