Skip to content

Commit e81a2f3

Browse files
committed
Got rid of CS0649 warnings
1 parent 72182de commit e81a2f3

File tree

10 files changed

+58
-1
lines changed

10 files changed

+58
-1
lines changed

DynamicPanels.unitypackage

1.78 KB
Binary file not shown.

Plugins/DynamicPanels/Editor/DynamicPanelsCanvasEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public override void OnInspectorGUI()
9191
reorderableListIndex = 0;
9292

9393
bool multiObjectEditing = targets.Length > 1;
94-
bool guiEnabled = !EditorApplication.isPlaying || PrefabUtility.GetPrefabType( ( (DynamicPanelsCanvas) serializedObject.targetObject ).gameObject ) == PrefabType.Prefab;
94+
bool guiEnabled = !EditorApplication.isPlaying || AssetDatabase.Contains( ( (DynamicPanelsCanvas) serializedObject.targetObject ).gameObject );
9595

9696
GUI.enabled = guiEnabled;
9797
GUILayout.BeginVertical();

Plugins/DynamicPanels/README.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
= Dynamic Panels =
2+
3+
Online documentation & example code available at: https://github.com/yasirkula/UnityDynamicPanels
4+
E-mail: yasirkula@gmail.com
5+
6+
1. ABOUT
7+
This asset helps you create dynamic panels using Unity's UI system. These panels can be dragged around, resized, docked to canvas edges or to one another and stacked next to each other as separate tabs.
8+
9+
2. HOW TO
10+
First, add Dynamic Panels Canvas component to the RectTransform that you want to move your panels inside. This RectTransform doesn't have to be the Canvas object. It can be any child of it and can be of any custom size.
11+
12+
There are two ways to create panels: by using the GUI of Dynamic Panels Canvas or via Scripting API. There are also two types of panels: free panels that can be moved around and resized freely and docked panels that are moved by the layout system, depending on where it is docked to. A panel can have multiple tabs.
13+
14+
To add a new free panel using the Dynamic Panels Canvas component, simply click the Add New button under the Free Panels section in the Inspector. Then, click the + button to start adding tabs to that panel. Each tab has 4 properties: the content (RectTransform) that will be displayed while the tab is active, a label, an optional icon, and the minimum size of the content associated to the tab. To remove a free panel, select a tab inside the panel and click the Remove Selected button.
15+
16+
You can create docked panels by using the buttons under the Docked Panels section. To create a panel that is docked to the edge of the Dynamic Panels Canvas, use the buttons next to "Dock new panel to canvas:". You can click a panel inside the preview zone (immediately under the Docked Panels section) and edit its tabs. You can also dock a panel to the selected panel using the buttons next to "Dock new panel inside:".
17+
18+
When you are done, click the Play button to see the magic happen!
19+
20+
There are a couple of settings in Dynamic Panels Canvas that you may want to play with:
21+
22+
- Leave Free Space: when enabled, there will always be some free space in the canvas that docked panels can't fill. Otherwise, docked panels will fill the whole canvas
23+
- Minimum Free Space: if Leave Free Space is enabled, this value will determine the minimum free space
24+
- Panel Resizable Area Length: the length of the invisible area at each side of a panel that allows users to resize a panel
25+
- Canvas Anchor Zone Length: the length of the dockable area of the Dynamic Panels Canvas. When a tab is dragged and dropped onto that area, it will be docked to the edge of the Dynamic Panels Canvas
26+
- Panel Anchor Zone Length: the length of the dockable area inside a panel. When a tab is dragged and dropped onto that area, it will be docked to the panel. This area is enabled only for docked panels (you can't dock panels to free panels)
27+
- Initial Size: (docked panels only) determines the initial size of a docked panel. This is achieved by programmatically resizing the panel after it is created, so this operation may affect the adjacent panels' sizes, as well. This value won't have any effect if left as (0,0)
28+
29+
NOTE: if you change the Resources/DynamicPanel.prefab, also make sure that the Panel's Header Height property is equal to the distance between the top of the panel and the bottom of the PanelHeader child object (which holds the tabs runtime).
30+
31+
2.1. PanelCursorHandler Component
32+
33+
Adding this component to a GameObject will make the cursor dynamic i.e. its texture will change when it enters a panel's resizable area.
34+
35+
Note that this component won't have any effect on Android and iOS.

Plugins/DynamicPanels/README.txt.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Plugins/DynamicPanels/Scripts/DynamicPanelsCanvas.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public string ID
145145
private RectTransform anchorZonesParent;
146146
private readonly CanvasAnchorZone[] anchorZones = new CanvasAnchorZone[4]; // one for each side
147147

148+
#pragma warning disable 0649
148149
[SerializeField]
149150
private bool m_leaveFreeSpace = true;
150151
public bool LeaveFreeSpace
@@ -191,6 +192,7 @@ public bool LeaveFreeSpace
191192
[HideInInspector]
192193
private List<SerializableAnchoredPanelProperties> initialPanelsAnchoredSerialized;
193194
private AnchoredPanelProperties initialPanelsAnchored;
195+
#pragma warning restore 0649
194196

195197
private bool updateBounds = true;
196198
private bool isDirty = false;

Plugins/DynamicPanels/Scripts/Helpers/PanelCursorHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class PanelCursorHandler : MonoBehaviour
1313
private bool isResizing;
1414
private Vector2 prevPointerPos;
1515

16+
#pragma warning disable 0649
1617
[SerializeField]
1718
private Texture2D horizontalCursor;
1819
[SerializeField]
@@ -21,6 +22,7 @@ public class PanelCursorHandler : MonoBehaviour
2122
private Texture2D diagonalCursorTopLeft;
2223
[SerializeField]
2324
private Texture2D diagonalCursorTopRight;
25+
#pragma warning restore 0649
2426

2527
private void Awake()
2628
{

Plugins/DynamicPanels/Scripts/Helpers/PanelHeader.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ namespace DynamicPanels
66
[DisallowMultipleComponent]
77
public class PanelHeader : MonoBehaviour, IBeginDragHandler, IDragHandler, IEndDragHandler
88
{
9+
#pragma warning disable 0649
910
[SerializeField]
1011
private Panel m_panel;
1112
public Panel Panel { get { return m_panel; } }
13+
#pragma warning restore 0649
1214

1315
private int pointerId = PanelManager.NON_EXISTING_TOUCH;
1416

Plugins/DynamicPanels/Scripts/Helpers/PanelSerialization.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace DynamicPanels
99
public static class PanelSerialization
1010
{
1111
#region Helper Classes
12+
#pragma warning disable 0649
1213
[Serializable]
1314
private class SerializedCanvas
1415
{
@@ -87,6 +88,7 @@ public GroupElementSizeHolder( IPanelGroupElement element, Vector2 size )
8788
this.size = size;
8889
}
8990
}
91+
#pragma warning restore 0649
9092
#endregion
9193

9294
private static readonly List<SerializedPanelTab> tabsTemp = new List<SerializedPanelTab>( 4 );

Plugins/DynamicPanels/Scripts/Helpers/PanelTab.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public void Stop()
3838
public void SetActive( bool activeState ) { tab.SetActive( activeState ); }
3939
}
4040

41+
#pragma warning disable 0649
4142
[SerializeField]
4243
private Image background;
4344

@@ -46,6 +47,7 @@ public void Stop()
4647

4748
[SerializeField]
4849
private Text nameHolder;
50+
#pragma warning restore 0649
4951

5052
public InternalSettings Internal { get; private set; }
5153

Plugins/DynamicPanels/Scripts/Panel.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ public void Stop()
198198

199199
public InternalSettings Internal { get; private set; }
200200

201+
#pragma warning disable 0649
201202
[SerializeField]
202203
private PanelHeader header;
203204

@@ -207,6 +208,7 @@ public void Stop()
207208

208209
[SerializeField]
209210
private RectTransform contentParent;
211+
#pragma warning restore 0649
210212

211213
private RectTransform resizeZonesParent;
212214
private readonly PanelResizeHelper[] resizeZones = new PanelResizeHelper[4]; // one for each side
@@ -216,6 +218,7 @@ public void Stop()
216218
private PanelAnchorZone panelAnchorZone;
217219
private PanelHeaderAnchorZone headerAnchorZone;
218220

221+
#pragma warning disable 0649
219222
[SerializeField]
220223
private float headerHeight = 50f;
221224

@@ -230,6 +233,7 @@ public void Stop()
230233
[SerializeField]
231234
private Color m_tabDetachingColor;
232235
public Color TabDetachingColor { get { return m_tabDetachingColor; } }
236+
#pragma warning restore 0649
233237

234238
public Vector2 Position { get { return RectTransform.anchoredPosition; } }
235239
public Vector2 Size { get { return RectTransform.sizeDelta; } }

0 commit comments

Comments
 (0)