Hi @yasirkula
Thank you giving the wonderful asset. This is what i need !. Quick Question : I had added two panels one on left and another on right. In the right side panel i have added two tabs as (Tab 1 & Tab 2 ). When switching from tab 1 to tab 2 , tab 2 get activated and tab 1 get deactivated. But for my functionality tab 1 should not get deactivated , it should be in active. (My Assumption Idea : when tab 2 get activated it automatically overlap the tab 1 so no necessary to deactivate tab 1 ). Revert me if have any idea on this.
This asset doesn’t seem to work in unity 2020.1.
Even in the included demo scene, when I hover over the game view window, it spams the console with the following error:
You probably need to add a CanvasRenderer to the game object "ResizeZoneLeft". Or your script needs to check if the component is attached before using it.
@abababbb You can change Plugins/DynamicPanels/Scripts/Helpers/NonDrawingGraphic.cs as follows:
using UnityEngine;
using UnityEngine.UI;
namespace DynamicPanels
{
// Credit: http://answers.unity.com/answers/1157876/view.html
[RequireComponent( typeof( CanvasRenderer ) )]
public class NonDrawingGraphic : Graphic
{
public override void SetMaterialDirty() { return; }
public override void SetVerticesDirty() { return; }
protected override void OnPopulateMesh( VertexHelper vh )
{
vh.Clear();
return;
}
}
}
I’ve submitted a bug report for this issue since it affects a number of my plugins and possibly some of the other UI related plugins out there, as well (we can see that it had affected TextMesh Pro , too).
Could you post a screenshot of how the panel will look like without the paneltab and where the button will be placed at so that I can visualize this scenario in my mind?
excuse me,the picture is my rough sketch,i want to drag the button to the right canvas,and the panel will move to
the right canvas automatically,can you give me some advice
Seems to me that you need 2 DynamicPanelsCanvas objects: one for the left area and one for the right area. And you’ll need 3 references:
public GameObject panelContents; // The grey object
public DynamicPanelsCanvas leftCanvas;
public DynamicPanelsCanvas rightCanvas;
When you move the button to the right area, you should call panelContents.GetComponentInParent<Panel>().DockToPanel(rightCanvas.RootPanelGroup, Direction.Top);
As for how to drag the button from one area to the other, it really is up to you; it is outside the scope of DynamicPanels. You can find plenty of UI drag&drop tutorials online.
P.S. If you aren’t interested in any of the fancy DynamicPanels stuff like tab stacking, horizontal/vertical panel layouts, then I’d recommend you to simply call panelContents.transform.SetParent(rightZone.transform, false); and not use DynamicPanels at all.
It is somewhat tightly coupled with other DynamicPanels classes and functions. I don’t think you can use that class on its own without greatly refactoring the code.
You have to make your panel a child of DynamicPanelsCanvas (1.1) and then add the panel to DynamicPanelsCanvas’ “= Free Panels =” list so that it becomes an actual Panel when the game starts. Then the system will add PanelResizeHelper objects to the panel’s all 4 edges automatically.
You can’t use PanelResizeHelper without this setup, as I said it will require moderate code refactoring.
Thanks, it worked after adding one more parent panel with DynamicPanelsCanvas. But still, there are some problems. I tried to understand the documentation on github page but it is not enough or too difficult for me.
When i play, the panel gets resize and takes the full width of the parent panel. Even, I have given the initial size and min size into docked panels. I am using dock panel the panel should dock but able to resize from top and right.
Is there any way available to not instantiate the header. I don’t want header.
Docked panels behave similar to Unity’s panels (e.g. Inspector, Hierarchy). In Unity, try closing all panels and leave only 2 panels that are docked side by side. You can resize only horizontally, not vertically. If you want to resize in all directions, then the panel must be a free panel.
You can modify DynamicPanel prefab in Resources folder but make sure to set the Panel’s Header Height property to 0. You may need to modify the DynamicPanelTab prefab, as well.
If you just want resizable panels and nothing more, I think DynamicPanels is an overkill. You can find example code snippets for resizable panels online; for example: UI Samples | Essentials | Unity Asset Store
You can modify the DynamicPanel (for 1, 2) and DynamicPanelTab (for 1) prefabs. If you change the height of the panel’s header in DynamicPanel prefab, make sure to update its Header Height property, as well.