Unity-Technologies / ui-toolkit-manual-code-examples

Unity UI Toolkit documentation code examples
455 stars 78 forks source link

THE CODE IN THIS REPO DOES NOT WORK #12

Open netlander opened 2 years ago

netlander commented 2 years ago

Great to see some examples for the new UI Toolkit. However, what would be really helpful is to make the entire repo as a Unity project and add a sample scene to each example.

Currently there are class name conflicts that are preventing the import of the entire repo into a single Unity project.

If the decision is taken to go with the above mentioned conversion I might find time to assist.

netlander commented 2 years ago

It seems that most of the code is Editor UI and NONE OF IT WORKS.

lilisha-unity commented 2 years ago

hi @netlander, thank you for your feedback. The code in this repo won't work by itself. This repo's code examples are for the UI Toolkit user manual. You must follow the steps in the user manual in order to have the code work. For example, this page teaches you how to create a drag-and-drop UI inside a custom Editor window. You can either copy/paste the code on the page or get the files from this repo (https://github.com/Unity-Technologies/ui-toolkit-manual-code-examples/tree/master/create-a-drag-and-drop-window-inside-a-custom-editor-window).

bradley-newman commented 4 months ago

would be nice if the examples were organized by assembly definitions to avoid the need to import each example separately. And used relative paths for assets instead of the hard coded paths like this:

var visualTree = AssetDatabase.LoadAssetAtPath<VisualTreeAsset>("Assets/Editor/DragAndDropWindow.uxml");