Saturday, April 1, 2023
HomeGame DevelopmentHow Do I add a button as a visible ingredient for a...

How Do I add a button as a visible ingredient 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 straightforward to comply with. 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 strains XX and XX when copied over. I’ve tripled checked the namespaces and many others and it appears to be the identical. Any concepts? The video and code is linked beneath, word its half of some completely different scripts which I can publish if it would present extra data.

Cheers,

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

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

namespace DS.Parts

{

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 alternative in Selections)
        {
            Port choicePort = InstantiatePort(Orientation.Horizontal, Path.Output, Port.Capability.Single, typeof(bool));

            choicePort.portName = "";

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

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

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

            outputContainer.Add(choicePort);
        }

        RefreshExpandedState();
    }
}

}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments