Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve documentation #4

Open
ethan-xd opened this issue Apr 29, 2024 · 1 comment
Open

Improve documentation #4

ethan-xd opened this issue Apr 29, 2024 · 1 comment

Comments

@ethan-xd
Copy link

ethan-xd commented Apr 29, 2024

I am new to Unity and I am struggling to import this into my Unity project.

I do not understand the steps of what is required as I'm not able to use this namespace in my code.

I would greatly appreciate if this project was updated with instructions on how to import this into my project.

The README also talks about an older version of the project.

@AlanSherba
Copy link

AlanSherba commented Jul 21, 2024

You need to add a manager to your document like so:

uiDocument.rootVisualElement.AddManipulator(new ContextualMenuPlayer.ContextualMenuManipulator());

Then you can create menus using the built in contextlMenuManipulator:

yourElement.AddManipulator(new ContextualMenuManipulator((evt) =>
{
    evt.menu.AppendAction("hello", (v) => { });
    evt.menu.AppendAction("test/one", (v) => { });
    evt.menu.AppendAction("test/two", (v) => { });
}));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants