Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by clinealex10 · Jul 05, 2019 at 03:39 PM · editorproject settingseditorscript

How do you get the rootElement for the SettingsProvider.activateHandler property?

So I'm trying to save data for a custom editor window and have recently discovered SettingsProvider and I'm trying to understand how to use it (The version meant for UIElements). I have a basic grasp of UIElements but this thing has got me stumped. The documentation makes it seem like you show have access to the root but it's not the cause.

Below, I'm trying to using the activeHandler property to override SettingsProvider.OnActivate() as described in the documentation (which is was its description says it's for) but it requires a visual element. When I create my own, it throws an error when assigning to the property (Cannont implicitly convert type '(string, UnityEngine.UIElements.VisualElement root)' to 'System.Action< string, UnityEngine.UIElements.VisualElement>') so I'm guessing you need to pass the actual root element for the settings window. Does anyone know how to do this? Or if this isn't how you use this, how are you supposed to do this?

Edit: Missed part of the error message.

 using System.IO;
 using UnityEngine.UIElements;
 using UnityEditor;
 
 namespace ACTools
 {
     namespace DataManager
     {
         class DataManagerSettingsProvider
         {
             public static bool IsSettingsAvailable()
             {
                 return File.Exists(DMDPaths.MyPath);
             }
 
             [SettingsProvider]
             public static SettingsProvider CreateDataManagerSettings()
             {
                 if (IsSettingsAvailable())
                 {
                     VisualElement root = new VisualElement();
                     SettingsProvider provider = new SettingsProvider("ACTools/Data Manager", SettingsScope.Project)
                     {
                     label = "Data Manager",
 
                     activateHandler = ("Data Manager", root),
 
                     };
                     return provider;
                 }
                 return null;
             }
         }
     }
 }

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by clinealex10 · Jul 30, 2019 at 01:08 PM

I think I figured out it out. It seems that you need to have "activateHandler = (searchContext, rootElement)" instead of having your own string and visual element like "activateHandler = ("Data Manager", root)". My guess is that searchContext and rootElement are just names you assign to parameters you can manipulate below, thus they need to not exist before you assign them. So you could name these two parameters anything you'd like.

Edit: "activateHandler = (searchContext, rootElement)" is actually in the SettingsProvider Scripting API page so if you just follow that, it should work.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

142 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why do I need to clic apply after editing a list content via editor script to access the list content in playmode 0 Answers

HDRP error 2021.3 LTS 0 Answers

Saving changes in a component modified by an editor script 3 Answers

How do I apply Default-Diffuse material to a MeshRenderer in code? 6 Answers

How to access editor script function? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges