Search Unity

  1. Click here to see what's on sale for the "Best of Super Sale" on the Asset Store
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Power Inspector | Complete Inspector Rewrite

Discussion in 'Assets and Asset Store' started by SisusCo, Aug 28, 2019.

?

What Are Your Favorite Features?

  1. Back and Forward Buttons

  2. Search Box

  3. Split View

  4. Copy-Paste

  5. Debug Mode+

  6. Quick Invoke Menu

  7. Create Script Wizard

  8. Keyboard Friendly

  9. Improved Tooltips

  10. Target Window

Multiple votes are allowed.
Results are only viewable after voting.
  1. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    @Stexe While I was not able to replicate the error you're seeing, I tweaked the header height calculation logic a bit in a way that I suspect might make the error you're seeing go away.

    I submitted a new update with the fix to the store just now, so it'll probably go live some time tomorrow. Please let me know if the issue still persists after the update.
     
    Stexe likes this.
  2. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    The update is now live.
     
  3. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    133
    Hi SisusCo, i bought your asset two days ago, so I don't think i have the newest version, let me upgrade and will come back if the same issues keep happening.

    EDIT: So far so good after updating, things seem to be working nicely, but will let you know if sth changes.
     
    Last edited: Mar 23, 2020
    SisusCo likes this.
  4. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    133
    Actually starting getting errors again. It now seems that they mostly come up when i am using the search functionality of the inspector. Here is what it looks like :

    https://imgur.com/a/mls5LAx
     
  5. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    133
  6. SpyrosUn

    SpyrosUn

    Joined:
    Nov 20, 2016
    Posts:
    133
    EDIT: Scratch that, I just noticed it exists with right click context menu on a component :D Awesome !

    By the way, is there by any chance a way to collapse/expand all the components of a gameobject with Power Inspector ? This has always been a feature that I wanted in the inspector and the online suggestions of ALT+click don't really seem to work. Would be really nice to have something like that !
     
    SisusCo and Stexe like this.
  7. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    Still getting the error. Here's a screenshot of it. I can give more info if needed.
     

    Attached Files:

  8. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    @Stexe Alright - time to get serious! :D I implemented three additional levels of protection against that pesky error:
    1. I now use reflection to make sure that it is safe to call GUILayoutUtility.GetLastRect before using it.
    2. I now only call GUILayoutUtility.GetLastRect once for each Editor header, so if the reflect check should fail for some reason then at least the error won't be spammed during every Repaint event.
    3. I went ahead and disabled dynamic header height calculations for the MaterialDrawer altogether. It is pretty unlikely that any users would have a custom editor for materials that also happens to change the header height, so this should be a pretty safe change to make.
    I'll submit an update with these changes tomorrow.
     
    Stexe likes this.
  9. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    @SpyrosUn Thanks for letting me know, I'll start working on getting those fixed tomorrow.
     
  10. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    That looks like it fixed it. Thanks! =)
     
    SisusCo likes this.
  11. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    New error popped up. I went to "Select Dependencies" on a prefab of some 3D objects and got this one:
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. Sisus.LinkedMemberHierarchy..ctor (UnityEngine.Object[] setTargets, System.Object setNonUnityObjectClassTarget) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Generic/LinkedMemberInfo/LinkedMemberHierarchy.cs:512)
    3. Sisus.LinkedMemberHierarchy.Get (UnityEngine.Object[] targets) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Generic/LinkedMemberInfo/LinkedMemberHierarchy.cs:373)
    4. Sisus.UnityObjectDrawer`2[TSelf,TTarget].Setup (TTarget[] setTargets, Sisus.IParentDrawer setParent, UnityEngine.GUIContent setLabel, Sisus.IInspector setInspector) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/UnityObjectDrawer.cs:1063)
    5. Sisus.CustomEditorBaseDrawer`2[TSelf,TTarget].Setup (TTarget[] setTargets, Sisus.IParentDrawer setParent, Sisus.IInspector setInspector, System.Type setEditorType) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/CustomEditorBaseDrawer.cs:409)
    6. Sisus.CustomEditorAssetDrawer.Setup (UnityEngine.Object[] setTargets, UnityEngine.Object[] setEditorTargets, System.Type setEditorType, Sisus.IParentDrawer setParent, Sisus.IInspector setInspector) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/Asset/CustomEditor/CustomEditorAssetDrawer.cs:453)
    7. Sisus.ModelDrawer.Setup (UnityEngine.Object[] setTargets, UnityEngine.Object[] setEditorTargets, System.Type setEditorType, Sisus.IParentDrawer setParent, Sisus.IInspector setInspector) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/Asset/CustomEditor/ModelDrawer.cs:94)
    8. Sisus.ModelDrawer.Create (UnityEngine.Object[] targets, Sisus.IParentDrawer parent, Sisus.IInspector inspector) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Drawers/UnityObject/Asset/CustomEditor/ModelDrawer.cs:78)
    9. Sisus.Inspector.RebuildDrawers (UnityEngine.Object[] targets, System.Boolean evenIfTargetsTheSame) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Inspector/Core/Inspector.cs:1126)
    10. Sisus.Inspector.RebuildDrawers (System.Boolean evenIfTargetsTheSame) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Inspector/Core/Inspector.cs:886)
    11. Sisus.Inspector.ForceRebuildDrawers () (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Inspector/Core/Inspector.cs:860)
    12. Sisus.Inspector.RequiresConstantRepaint () (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Inspector/Core/Inspector.cs:2371)
    13. Sisus.InspectorUtility.BeginInspectorDrawer (Sisus.IInspectorDrawer inspectorDrawer, Sisus.ISplittableInspectorDrawer splittable) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Inspector/Utility/InspectorUtility.cs:280)
    14. Sisus.InspectorDrawerWindow.OnGUI () (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/EditorWindow/InspectorDrawerWindow.cs:1574)
    15. System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
    16. Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
    17. UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection, UnityEngine.UIElements.PanelClearFlags clearFlags) (at <085559680b9141e8b8c144c684aaa6d7>:0)
    18. UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection) (at <085559680b9141e8b8c144c684aaa6d7>:0)
    19. UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <085559680b9141e8b8c144c684aaa6d7>:0)
    20. UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <085559680b9141e8b8c144c684aaa6d7>:0)
    21. UnityEngine.UIElements.Panel.UpdateForRepaint () (at <085559680b9141e8b8c144c684aaa6d7>:0)
    22. UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <085559680b9141e8b8c144c684aaa6d7>:0)
    23. UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <085559680b9141e8b8c144c684aaa6d7>:0)
    24. UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <085559680b9141e8b8c144c684aaa6d7>:0)
    25. UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <1006e0a2a62b4fc092e72663bea815ca>:0)
    26.  
    When I clicked off and then clicked back on to the dependencies it went away. Might be the showing of multiple objects organized by type shown when using "Select Dependencies" in Unity.
     
  12. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Thanks, I'll check it out.
     
  13. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    I think I found where the problem was. The issue probably occurred if you had multiple targets of different types selected and the first one happened to be a model. This should be fixed in the next version.
     
    Stexe likes this.
  14. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    I'm also having trouble when I'm using the "Addressable Asset" bundle with Unity. It cuts off part of it when clicking on a prefab or other asset in the folder structure.
     

    Attached Files:

  15. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Alright thanks, I'll look into this too.

    EDIT: Fixed. I'll add it to the next update.
     
    Last edited: Mar 25, 2020
    Stexe likes this.
  16. theforgot3n1

    theforgot3n1

    Joined:
    Sep 26, 2018
    Posts:
    13
    Hello SisusCo.

    I really like the functionality of the power inspector, but I have noticed that when I have the window open and I hit "Run" it takes about 3 seconds longer for the game to start (which is about twice as long as without it). Is there some way of preventing this? This is literally the only thing I don't like about it so far, I really hope there is a fix for this!

    If it is the only way, I wouldn't mind, for example, turning off more expensive stuff and only keeping a couple of functions, namely copy-paste, back and forward, search, debug mode and invoke.

    I am not sure what is causing it. I've been getting a couple of null pointer exceptions from some drawing scripts, but I imagine that wouldn't be the cause.

    Here are two videos comparing the difference in start-up time. The first one is the regular inspector, the second is the power inspector.

    regular_inspector.gif power_inspector.gif

    As you can see, there is quite a bit of difference in the start-up time. Since I generate my game in runtime, I would really like this not to be the case.

    Note: I do work on a laptop, it's sufficient for unity but not a powerhouse or anything.
     
    Stexe likes this.
  17. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    Had trouble renaming an empty GameObject I had just created. Every time I clicked on the name in the Power Inspector tab it would unselect the text field and select the Power Inspector tab, or at least that's what it looked like it was doing. I eventually dragged the tab out and got it to focus, but when I started typing after a few letters all of Unity crashed.

    Sorry I couldn't be more helpful in what caused it. I'll report back if it happens again and/or I can reproduce it.

    EDIT: Happens every time. I see a white box pop up for like a fraction of a second in the lower right hand corner. If I try to click and drag text it crashes Unity, along with other stuff.
     
    Last edited: Apr 1, 2020
  18. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Hi theforgot3n1! I am currently working on rewriting the entire initialization processes in order to try and reduce this pain point as much as possible. For example I'm moving as much of the work as possible to background threads so that the main thread won't freeze like this, even if it still takes a couple of seconds for Power Inspector itself to become fully responsive.

    The reason why the setup takes so long is that I am building some large dictionaries which require iterating through all types that exist in the project, checking them for attributes and such. These dictionaries are needed for base level things such as mapping all the drawers to the types they are responsible for drawing.
     
  19. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Have you tried if resetting your editor Layout helps? The white box popping up kind of sounds like there is a zombie window open that has failed to load properly and crashes the editor if it gains focus.
     
    Stexe likes this.
  20. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    That seemed to work. Now getting this issue.
    Code (CSharp):
    1. PlayerSettings Validation: Requested build target group (0) doesn't exist; #define symbols for scripting won't be added.
    2. UnityEditor.PlayerSettings:SetScriptingDefineSymbolsForGroup(BuildTargetGroup, String)
    3. Sisus.ScriptingDefines:Add(String) (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Define/ScriptingDefines.cs:25)
    4. Sisus.PowerInspectorInstaller:AddDefineIfMissingAndShowWelcomeScreenIfNotShown() (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Define/PowerInspectorInstaller.cs:32)
    5. Sisus.PowerInspectorInstaller:.cctor() (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/Define/PowerInspectorInstaller.cs:14)
    6. UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes(Type[])
    7.  
    I've changed my build to Android and I'm doing some stuff with reading QRCodes. Unsure if they are related but those are the only things I've changed recently.
     
  21. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    @Stexe I see...I'm passing the return of value EditorUserBuildSettings.selectedBuildTargetGroup to the method there, and it seems like it is possible for it to return BuildTargetGroup.Unknown in some situations. I'll alter the code to handle this better. Thanks for the report!
     
    Stexe likes this.
  22. theforgot3n1

    theforgot3n1

    Joined:
    Sep 26, 2018
    Posts:
    13
    That sounds really neat. Any estimate on when this update might be done? Some estimate would be nice to have in mind.
     
  23. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    @theforgot3n1 I've now managed to reduce the initialization time by around 30% and offloaded practically all of the processing to background threads. I just need to do some testing to make sure that all systems are still working as they should after the thread safe rewrites.

    I'm hoping I could submit the update for validation before the end of the day so that it could maybe become available for download before the weekend. If not then it should be out early next week at least.
     
  24. theforgot3n1

    theforgot3n1

    Joined:
    Sep 26, 2018
    Posts:
    13
    Damn that's cool. I'm waiting with anticipation!
     
  25. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    The new update with an overhauled setup process has now been submitted for approval. It'll likely be available for download early next week.
     
    Stexe likes this.
  26. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    Code (CSharp):
    1. IndexOutOfRangeException: Index was outside the bounds of the array.
    2. Sisus.Editors+<>c__DisplayClass29_0.<OnAfterDeserialize>b__0 () (at Assets/Plugins/Sisus/Power Inspector/Code/Editor/DrawGUI/Editors.cs:696)
    3. UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at <887a438259064e89922419bc7b8810ab>:0)
    4.  
    Getting this sometimes now when I hit play.

    Been also having crashing with it at times too when creating GameObjects or moving around GameObjects and Power Inspector not updating properly (shows a previous clicked instead of the new clicked + dragged). Haven't narrowed down on the issues, but I've mainly just been using Power Inspector now for Debug and Invoking methods and a few other tiny things... Hopefully it becomes more stable going forward since I really do like its features, but can't replace just normal Inspector due to crashing being problematic.

    Wonder if it is due to other assets? I'm using things that are mentioned to work with it, including Peek. But I doubt it is that?
     
  27. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Thanks, I'll have a fix for this in the next update.

    I have not experienced any crashing myself when using just Power Inspector, so it is possible that it is a compatibility issue. I can do some testing with Peek next week, and also try to do lots of GameObject creation and such, see if I can't replicate this.

    If you run into another crash the Editor.log file might contain some useful information. If you search for "Crash!!!" inside the file below that there's usually a stack trace for the call that caused the crash.
     
    Stexe likes this.
  28. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    @Stexe I tried creating and reordering lots of GameObjects with Power Inspector + Peek + Hierarchy Pro installed, but was not able to reproduce the crashing. I did find and fix one minor issue that occurred when opening Power Inspector as a Peek Tab inside the scene view though.

    It could be the inspecting of a specific component in your project that is triggering the crash. If you're able to send me a post-crash log file or a project that can be used to reproduce the crash it would be a big help.
     
  29. dozhwal

    dozhwal

    Joined:
    Aug 21, 2014
    Posts:
    58
    hi,

    thank you for your asset, it's very interisting.

    I have 2 questions :
    - the XML documentation tooltip don't seam to work, even if the checkbox is checked. What are the conditions to make it work ? (C# versions ? name space s?.. i don't know)
    - what is the easiest way to add buttons on the component toolbar. i want to add some of the context menu commands : copy, paste values, remove the component. to skip some "clicks".
    Thank for your response.
     
  30. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Hi there @dozhwal I'm glad to hear that Power Inspector looks interesting to you!


    Tooltips should get generated automatically from XML documentation comments found in script assets in your Assets directory, DLLs that have a XML documentation file and scripts assets inside packages.

    Currently tooltips are only generated from XML documentation comments preceded by triple slashes (///). For example:
    Code (CSharp):
    1. /// This is a tooltip.
    2. public bool hasTooltip;
    3.  
    4. /// <summary>
    5. /// This is a tooltip.
    6. /// </summary>
    7. [ShowInInspector]
    8. public bool AlsoHasTooltip
    9. {
    10.     get;
    11.     set;
    12. }
    13.  
    14. /// <summary>
    15. /// This is a tooltip for the method.
    16. /// </summary>
    17. /// <param name="text"> This is a tooltip for the parameter. </param>
    18. [ShowInInspector]
    19. public void MethodWithTooltip(bool text)
    20. {
    21.  
    22. }
    Comments using only double slashes (//) or multi-line comments (/* */) are not currently supported.
    Code (CSharp):
    1. // This is not a tooltip.
    2. public bool hasNoTooltip
    3.  
    4. public bool alsoHasNoTooltip; // This is not a tooltip.
    5.  
    6. /* This is not a tooltip. */
    7. public void MethodWithNoTooltip()
    8. {
    9.  
    10. }
    The feature has not been tested thoroughly outside of the windows platform, so it is possible that some aspects of it could fail to work on other platforms.


    As for extending the header toolbar for all components, as things currently stand it unfortunately is not an easy or user-friendly thing to do, at least not without directly editing the UnityObjectDrawer class - which could result in conflicts whenever updating Power Inspector.

    You can pull this off by creating a drawer that extends ComponentDrawer and overrides the DoBuildHeaderButtons and UpdateHeaderToolbarPositions methods, but it is not very pretty:
    Code (CSharp):
    1. using Sisus;
    2. using UnityEngine;
    3.  
    4. public class ExtendedComponentDrawer : ComponentDrawer
    5. {
    6.     /// <inheritdoc/>
    7.     protected override void DoBuildHeaderButtons()
    8.     {
    9.         base.DoBuildHeaderButtons();
    10.  
    11.         var icon = UnityEditor.EditorGUIUtility.IconContent("Clipboard").image;
    12.         headerParts.Add(HeaderPartDrawer.Create(HeaderPart.CustomHeaderButton1, true, true, icon, "", OnCustomHeaderButtonClicked, OnCustomHeaderButtonRightClicked, true));
    13.     }
    14.  
    15.     private void OnCustomHeaderButtonClicked(Event inputEvent)
    16.     {
    17.         Debug.Log("Button clicked.");
    18.     }
    19.  
    20.     private void OnCustomHeaderButtonRightClicked(Event inputEvent)
    21.     {
    22.         Debug.Log("Button right-clicked.");
    23.     }
    24.  
    25.     protected override void UpdateHeaderToolbarPositions(Rect headerRect)
    26.     {
    27.         base.UpdateHeaderToolbarPositions(headerRect);
    28.  
    29.         for(int n = headerParts.Count - 1; n >= 0; n--)
    30.         {
    31.             var headerPart = headerParts[n];
    32.             if(headerPart.Part == HeaderPart.CustomHeaderButton1)
    33.             {
    34.                 headerPart.Rect = GetCustomHeaderButtonPosition(headerRect);
    35.             }
    36.         }
    37.     }
    38.  
    39.     private Rect GetCustomHeaderButtonPosition(Rect headerRect)
    40.     {
    41.         Rect rect;
    42.         if(HasDebugModeIcon)
    43.         {
    44.             rect = DebugModeIconPosition;
    45.         }
    46.         else if(HasExecuteMethodIcon)
    47.         {
    48.             rect = ExecuteMethodIconPosition;
    49.         }
    50.         else if(HasReferenceIcon)
    51.         {
    52.             rect = ReferenceIconPosition;
    53.         }
    54.         else if(HasPresetIcon)
    55.         {
    56.             rect = PresetIconPosition;
    57.         }
    58.         else if(HasContextMenuIcon)
    59.         {
    60.             rect = ContextMenuIconPosition;
    61.         }
    62.         else
    63.         {
    64.             rect = headerRect;
    65.             rect.x += headerRect.width;
    66.         }
    67.         rect.x -= HeaderToolbarIconWidth;
    68.         rect.width = HeaderToolbarIconWidth;
    69.         return rect;
    70.     }
    71. }

    It is also not currently possible to easily change the default fallback drawer used for all components using something like the DrawerForComponent attribute, so the only way to make Power Inspector to actually use the new drawer is to also override the drawer provider:
    Code (CSharp):
    1.  
    2. using System;
    3. using Sisus;
    4. using Sisus.Attributes;
    5. [DrawerProviderFor(typeof(PowerInspector))]
    6. public sealed class ExtendedDrawerProvider : DefaultDrawerProvider
    7. {
    8.     protected override Type GetDrawerTypeForComponent(Type componentType, out Type customEditorType)
    9.     {
    10.         var drawerType = base.GetDrawerTypeForComponent(componentType, out customEditorType);
    11.         if(drawerType == typeof(ComponentDrawer))
    12.         {
    13.             return typeof(ExtendedComponentDrawer);
    14.         }
    15.         return drawerType;
    16.     }
    17. }
    18.  

    Making it easier to extend the header toolbar has been something I have been considering doing. I could start working on implementing that now that clearly somebody would be interested in the functionality and all :)
     
    Last edited: Apr 7, 2020
  31. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    I submitted a new version for approval that will make it much easier to add new header toolbar items. All you need to do now is to add the HeaderToolbarItem attribute to a static method that returns a HeaderPartDrawer.

    Here's an example that adds toolbar items for copying and pasting the state of the component / asset.
    Code (CSharp):
    1. using Sisus;
    2. using Sisus.Attributes;
    3.  
    4. public static class HeaderToolbarItems
    5. {
    6.     [HeaderToolbarItem(typeof(UnityEngine.Object))]
    7.     private static HeaderPartDrawer CopyToClipboard()
    8.     {
    9.         var icon = UnityEditor.EditorGUIUtility.IconContent("Clipboard").image;
    10.         return HeaderPartDrawer.Create(icon, (containingDrawer, clickedRect, inputEvent)=>
    11.         {
    12.             containingDrawer.CopyToClipboard();
    13.         }, "Copy To Clipboard");
    14.     }
    15.  
    16.     [HeaderToolbarItem(typeof(UnityEngine.Object))]
    17.     private static HeaderPartDrawer PasteFromClipboard()
    18.     {
    19.         var icon = UnityEditor.EditorGUIUtility.IconContent("Clipboard").image;
    20.         return HeaderPartDrawer.Create(icon, (containingDrawer, clickedRect, inputEvent) =>
    21.         {
    22.             if(Clipboard.CanPasteAs(containingDrawer.Type))
    23.             {
    24.                 containingDrawer.PasteFromClipboard();
    25.             }
    26.         }, "Paste From Clipboard");
    27.     }
    28. }
    Result:
    header-toolbar-menu-item-example.png
     
  32. dozhwal

    dozhwal

    Joined:
    Aug 21, 2014
    Posts:
    58
    Super ! i have tried something before your update but icons were overlapping :p

    Ok for XML. i tried it on a already big project on 2019.3, C# 4.0, windows, targeting android, and nothing appeared, but maybe it's because of the project.

    I tried on a empty project and it works well !


    Thank you !
     
    SisusCo likes this.
  33. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    To everyone that has been bothered by the initialization time: the latest update brings even further improvements in this area!

    Some of the setup data that is most time-consuming to initialize is now cached on disk (big thanks to ANDREAS for coming up with the idea!). Whenever scripts are reloaded Power Inspector can now start off using this cached data, allowing it to start functioning almost immediately. The full reinitialization process will still run in the background and once it has finished the setup data is updated, so that any changes made to custom editor targets and such will be fully reflected inside the inspector as soon as possible.


    The add component menu has also received a new layer of polish in recent updates. Most notably icons for groups are now automatically generated based on the icons of components contained within the group. I hope you like this change!

    add-component-menu-group-icons.png

    Also good news if you use playmode tinting - support for this has been improved a bunch in the latest version. All parts of Power Inspector should now get properly tinted when in play mode (let me know if you find anything I've missed).
     
    Stexe likes this.
  34. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    Been noticing some issues when using Hierarchy Pro's GameObject bookmark. I'll select it and nothing will happen in the Inspector. I have to click off and then click on it again.

    EDIT: Looks like it happens with some GameObjects too. I'll have it selected, either enter play mode or compile or switch tabs, and then come back and the Inspector is blank despite the GameObject being selected. I have to click off and back on for it to come up with stuff.

    EDIT2: Looks like my scene has been crashing using Power Inspector when I click on a DLL file.
     
    Last edited: Apr 18, 2020
  35. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Hi @Stexe Would you be able to send me that log file? I'm still not able to reproduce any of these issues in my own testing, so without seeing those log entries it is difficult for me to help you.

    Are you by any chance using some asset that overrides the default Editor used by GameObjects or assets?
     
  36. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    I'm using quite a few assets, which I'm sure is probably one of the main reasons. I recently removed Peek since it was causing some headaches. As for the other stuff I'm using Unity 2019.3.10f1 with:
    • Power Inspector
    • Hierarchy Pro
    • Editor Console Pro
    • Odin Inspector
    • Script Inspector 3
    • Extended Transform Editor
    • Rainbow Folders 2
    • Peek [formerly]
    • Runtime Inspector & Hierarchy [formerly]
    I can send logs the next time it crashes. Busy doing some other stuff right now and want to get this done first.
     
    SisusCo likes this.
  37. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    Any chance you could add the ability to see static variables in Debug mode? If that's possible it would be useful.
     
  38. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    It is already possible to view static members of any class, and Debug Mode+ works in combination with this.

    Admittedly the feature is not very easy to discover as it currently stands, being hidden behind the extended context menu and all, so it may still be a good idea to always allow listing static members in Debug Mode+. I think I will add this option, but I'll probably have to redesign the display settings control a bit in order to fit in all the different toggles in there.

    Thanks for the feedback!
     
    Last edited: Apr 20, 2020
    Stexe likes this.
  39. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    177
    Gotcha. I thought it would just be displayed along with the rest of the variables in Debug Mode+.

    I should be finishing my current stuff in a week or so and then I can try to do some debugging and send over log files for the issues I'm having with Power Inspector.

    One recent one that cropped up is some entry fields won't input any data. If I open the basic Inspector I can input values but not in Power Inspector.
     
    SisusCo likes this.
  40. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    I'll keep an eye out for this one. If you can post a screenshot of the inspector with the malfunctioning field it would be helpful, sometimes issues might only occur when a specific combination of drawers are being used.
     
    Stexe likes this.
  41. xinoHITO1

    xinoHITO1

    Joined:
    Jul 2, 2012
    Posts:
    26
    Sorry if this has already been asked but I've been having issues in Unity 2019.4 LTS ... when I select values in the power inspector and try to modify them I can't.

    For example, I was trying to set a Canvas Scaling to from "Constant Pixel Size" to "Scale with Screen Size" and it didn't work. I also tried to modify the transform of a GameObject in my scene and it doesn't work. Any help with this please?
     
    Stexe likes this.
  42. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Hi @xinoHITO1

    I haven't tested Power Inspector in Unity 2019.4 yet. I'm away from my computer right now, but I'll try installing the new version come Monday and see if I can replicate any of the issues you've described.
     
  43. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Hi again @xinoHITO1 . I wasn't able to reproduce your issues in my testing in Unity 2019.4. It could be because the issues will only occur when the inspector contains some specific components containing some specific kinds of fields. Would it be possible for you to post a screenshot of the contents of the inspector in the state where these issues are occurring?
     
  44. Patrickini

    Patrickini

    Joined:
    Feb 14, 2017
    Posts:
    1
    Hello, I'm using unity 2019.4, and i've noticed that PI is performing very slow, and also it has some issues like: not being able to mark the addressables checkbox in each asset, when i drag an script to the inspector it won't allow to assign it to the selected object ( I have to drag the script to the object in the hierarchy instead ), some times it wont let me assign objects with drag and drop, i have noticed this is common each time I tried to assign a camera to the canvas, and lastly it won't let me remove an script that is missing from the object, instead I have to assign another script before removing the component.
    I moved Sisus folder to Plugins in assets, and the performance increases a little bit but it causes issues with an assembly, so I havent done that again XD

    Also other assets that i'm using are: Rainbow Folders 2, and Dotween Pro 2
    I already tried using PI on a new project without those assets and had no luck.

    I hope you can help me, sorry for my bad english :)

    -P

    Two weeks ago I tried to contact you on your website, thanks for all of your hard work and for the help :)
     
  45. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    Hi @Patrickini , thanks for all the feedback! I will add all of the aforementioned bugs to my to do list.

    The inability to remove missing scripts from GameObjects with no other components is a known issue, and I have not yet discovered any way to get around this limitation using Unity's current scripting API :( So until Unity introduces changes on that front, workarounds will have to be continued to be used.

    As for figuring out the source of your performance issues: could you temporarily enable developer mode for Power Inspector, then perform some actions that showcase the slowdowns, and then send me your editor log file in a private message? Then I could have a look to see if I could spot anything that could be causing these slowdowns in the log file. Thanks!
     
    Stexe likes this.
  46. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    44
    Thanks for the asset, it's pretty awesome, it's one of those that is an auto-include in any project but I've found a couple of annoying issues that I'd like to let you know about in case you are not aware already.

    - Clicking on a field, like say Rotation Y, and dragging the mouse outside of the inspector area causes it to not register when you let go of the mouse button and the value keeps following its movements. I have to either click once again or bring the mouse back into the inspector window and release, which kind of defeats the point.
    I do that a lot to change the directional light's rotation easily for example and I am finding myself opening a temporary vanilla inspector every time I need to do something of the sort.
    Hopefully that makes sense.

    - I have also encountered a similar issue to what @xinoHITO1 mentioned where fields just stop responding to changes, forcing me to close and open the inspector again. The inspector still updates as I select other objects and assets, I just can't change any values.
    I have not been able to figure out when exactly it happens, it seems random. Some times I'm messing with a material, other times I'm messing with post processing, other times I am messing with a prefab's values...

    - When opening a new instance of the inspector the preview box (where it shows you your texture/material) at the bottom of the inspector always comes up huge. This would mostly be a very small issue if I didn't have to open and close the inspector frequently due to the bug where fields stop responding. It would be nice if it remembered how it was prior to closing.

    - Also every time I import the asset into a project Unity forces me to run the API Updater complaining that it found obsolete APIs.

    Unity 2020.2.0a21
    Power Inspector 1.4.4
     
    Last edited: Sep 1, 2020
    Stexe likes this.
  47. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    I'm glad to hear you've found it useful! :)

    I was not able to reproduce this behaviour. I'm wondering if some other window you have open could be consuming the mouse up event... Could you maybe try temporarily reverting back to the Default layout (save your current layout first so you can restore it afterwards), and then try opening Power Inspector and see if the dragging glitch still occurs?

    Thanks for providing me with more information on this. It is difficult to get this issue fixed since it's so difficult to replicate and seems to happen so randomly, but I'll keep doing more testing and hopefully I'll be able to crack it at some point.

    Yeah, I can see how that could be annoying. I can make the preview height persist through closing of the inspector window. Currently I think only the minimized state is persistent.

    This did not happen for me when I imported Power Inspector to an empty project in Unity 2020.2.0a21. It could be that it only happens when using specific target platforms or API compatibility levels, so I'll do some further testing.

    Thanks for all the feedback!
     
    Stexe likes this.
  48. Bezoro

    Bezoro

    Joined:
    Mar 16, 2015
    Posts:
    44
    Just created an empty project and imported Power Inspector as the only asset and I got it immediately.

    Same thing. New project, only Power Inspector imported.
    Reset layout to Default, opened an instance of Power Inspector, clicked and dragged on Y. When the mouse leaves the inspector area it does not listen for when you release the button.
    A workaround for the time being is pressing Esc.

    To be more thorough:
    Unity 2020.2.0a21
    Windows Build support (IL2CPP) is the only platform module installed.
    Using the HDRP template for the projects.
    (API Compatibility Level is set by default to .NET Standard 2.0
    And Scripting Backend to IL2CPP)
    Power Inspector 1.4.4

    Sorry for being the bearer of bad news, I wish I didn't need to bug you about these things.
     
    Last edited: Sep 2, 2020
  49. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    @Bezoro No worries, I appreciate you taking the time to provide me with this additional info :)

    I was now in fact able to reproduce both of the issues with the aforementioned configuration, and can start working on fixing them both.
     
    Stexe and Bezoro like this.
  50. SisusCo

    SisusCo

    Joined:
    Jan 29, 2019
    Posts:
    466
    The issue related to the dragging of prefixes of numeric fields turned out to happen due to a bug on Unity's side. I have reported the issue to Unity and it has been added to their issue tracker. I added a temporary workaround for this issue anyways in version 1.4.5 - which is out now.

    The new version also makes the height of the preview area persist even if the power inspector window is closed and the API Updater should no longer pop up after installation in Unity 2020.2 alpha.
     
    Bezoro likes this.
unityunity