Skip to content

Commit 71cd387

Browse files
committed
Added new custom editors. Improved pooling to return RefItem instead of
GameObject for optimization purposes. Added new script icon and removed old ones. Removed unnecessary comments. Improved spawner and added RefPlacer.
1 parent 0334452 commit 71cd387

File tree

95 files changed

+1276
-668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+1276
-668
lines changed

Editor/EditorUtil.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ public static class EditorUtil
1010
public static void CreatePool(MenuCommand menuCommand)
1111
{
1212
GameObject go = new("Pool");
13-
go.AddComponent<Pool>();
13+
go.AddComponent<RefPooler>();
1414
EditorCreeate(menuCommand, go);
1515
}
1616

1717
[MenuItem("GameObject/RefPool/Group", false, 10)]
1818
public static void CreateGroup(MenuCommand menuCommand)
1919
{
20-
GameObject root = new("Group", typeof(PoolGroup));
21-
var rootGroup = root.GetComponent<PoolGroup>();
20+
GameObject root = new("Group", typeof(RefPoolerGroup));
21+
var rootGroup = root.GetComponent<RefPoolerGroup>();
2222
for (int i = 0; i < 3; i++)
2323
{
24-
GameObject child = new($"Pool #{i + 1}", typeof(Pool));
24+
GameObject child = new($"Pool #{i + 1}", typeof(RefPooler));
2525
child.transform.SetParent(root.transform);
26-
rootGroup.AddPool(child.GetComponent<Pool>());
26+
rootGroup.AddPool(child.GetComponent<RefPooler>());
2727
}
2828
EditorCreeate(menuCommand, root);
2929
}
@@ -32,7 +32,7 @@ public static void CreateGroup(MenuCommand menuCommand)
3232
[MenuItem("GameObject/RefPool/Spawner", false, 10)]
3333
public static void CreateSpawner(MenuCommand menuCommand)
3434
{
35-
GameObject root = new("Spawner", typeof(PoolSpawner));
35+
GameObject root = new("Spawner", typeof(RefSpawner));
3636
EditorCreeate(menuCommand, root);
3737
}
3838

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using UnityEngine.UIElements;
4+
5+
namespace BP.RefPool.Editor
6+
{
7+
[CustomEditor(typeof(PoolAsset))]
8+
public class PoolAssetEditor : UnityEditor.Editor
9+
{
10+
[SerializeField] private VisualTreeAsset treeAsset;
11+
12+
public override VisualElement CreateInspectorGUI()
13+
{
14+
var root = new VisualElement();
15+
treeAsset.CloneTree(root);
16+
return root;
17+
}
18+
}
19+
}

Editor/PoolAsset/PoolAssetEditor.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
2+
<ui:TextField label="Display Name" binding-path="displayName" />
3+
<uie:ObjectField label="Prefab" type="UnityEngine.GameObject, UnityEngine.CoreModule" binding-path="prefab" />
4+
<ui:Toggle label="Persistent" binding-path="isPersistant" />
5+
<ui:Toggle label="Reuse Objects" data-source-path="reuseObjects" />
6+
<ui:Label text="Size" style="-unity-text-align: upper-center; -unity-font-style: bold; font-size: 16px; margin-top: 10px;" />
7+
<ui:IntegerField label="Init Size" value="0" binding-path="initSize" />
8+
<ui:IntegerField label="Max Size" value="0" binding-path="maxSize" />
9+
</ui:UXML>

Editor/PoolAsset/UXML_PoolAsset.uxml.meta

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using UnityEngine.UIElements;
4+
5+
namespace BP.RefPool.Editor
6+
{
7+
[CustomEditor(typeof(PoolGroupAsset))]
8+
public class PoolGroupEditor : UnityEditor.Editor
9+
{
10+
[SerializeField] private VisualTreeAsset treeAsset;
11+
public override VisualElement CreateInspectorGUI()
12+
{
13+
var root = new VisualElement();
14+
treeAsset.CloneTree(root);
15+
return root;
16+
}
17+
}
18+
}

Editor/PoolGroup/PoolGroupEditor.cs.meta

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<ui:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="True">
2+
<ui:TextField label="Display Name" binding-path="displayName" />
3+
<ui:EnumField label="Pick Mode" value="Random" type="BP.RefPool.PoolPickMode, BP.RefPool" />
4+
<ui:Toggle label="Persistent" binding-path="isPersistent" />
5+
<ui:Label text="Pools" style="margin-top: 10px; font-size: 16px; -unity-font-style: bold; -unity-text-align: upper-center;" />
6+
<ui:ListView binding-path="pools" reorderable="true" show-bound-collection-size="false" show-add-remove-footer="true" reorder-mode="Animated" show-border="true" />
7+
</ui:UXML>

0 commit comments

Comments
 (0)