Sunday, July 17, 2022
HomeGame DevelopmentHow Do I add a button as a visible component for a...

How Do I add a button as a visible component for a customized editor Unity


I am a touched stumped with a tutorial collection I am watching. Its not very talked-about however the man is tremendous effectively spoken and simple to observe. The whole lot thus far has been alright, up till he tried so as to add some buttons to a customized editor window. It does not appear to acknowledge traces XX and XX when copied over. I’ve tripled checked the namespaces and so forth and it appears to be the identical. Any concepts? The video and code is linked under, word its half of some completely different scripts which I can publish if it is going to present extra data.

Cheers,

video hyperlink
https://www.youtube.com/watch?v=xcwBqQxn1pQ&listing=PL0yxB6cCkoWK38XT4stSztcLueJ_kTx5f&index=11&ab_channel=IndieWafflus

I can not seem to embody the primary few traces so I am going to sort whats happening. I am utilizing Methods.Collections, System.Collections.Generic, UnityEditor.Experimental.GraphView, UnityEngine, UnityEngine.UIElements, UnityEngine.UI

namespace DS.Components

{

utilizing Enumerations;

public class DSMultipleChoiceNode : DSNode
{
    public override void Initialise(Vector2 place)
    {
        base.Initialise(place);

        DialogueType = DSDialogueType.MultipleChoice;

        Selections.Add("New Selection");
    }

    public override void Draw()
    {
        base.Draw();

        /* MAIN CONTAINER*/

        Button addChoiceButton = new Button(){textual content = "Add Selection";

        mainContainer.Insert(1,addChoiceButton);

        /*OUTPUT CONTAINER*/

        foreach (string selection in Selections)
        {
            Port choicePort = InstantiatePort(Orientation.Horizontal, Route.Output, Port.Capability.Single, typeof(bool));

            choicePort.portName = "";

            Button deleteChoiceButton = new Button() { textual content = "X" };

            TextField choiceTextField = new TextField() { worth = selection};

            choicePort.Add(choiceTextField);
           choicePort.Add(deleteChoiceButton);

            outputContainer.Add(choicePort);
        }

        RefreshExpandedState();
    }
}

}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments