File tree 5 files changed +8
-41
lines changed
.idea/.idea.Unity-Object-Pooling/.idea
Assets/CustomTools/ObjectPooling/Scripts/ObjectPool 5 files changed +8
-41
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,8 @@ public void Despawn(GameObject obj)
93
93
{
94
94
PooledObjectType pooledObjectType = obj . GetComponent < IPooledObject > ( ) . PoolType ;
95
95
96
- if ( pooledObjectType != null && _poolDictionary . ContainsKey ( pooledObjectType ) )
96
+ if ( _poolDictionary . ContainsKey ( pooledObjectType ) && // check if there's a queued objects by that tag.
97
+ _poolDictionary [ pooledObjectType ] . Contains ( gameObject ) ) // check if `obj` is already despawned
97
98
{
98
99
99
100
@@ -111,7 +112,7 @@ public void Despawn(GameObject obj)
111
112
}
112
113
else
113
114
{
114
- Debug . LogError ( "Trying to despawn object which is not pooled !" ) ;
115
+ Debug . LogError ( "Trying to despawn object which is not pooled or object is already despawned !" ) ;
115
116
}
116
117
117
118
}
Original file line number Diff line number Diff line change 5
5
"com.unity.ads" : " 3.5.2" ,
6
6
"com.unity.analytics" : " 3.3.5" ,
7
7
"com.unity.collab-proxy" : " 1.2.16" ,
8
- "com.unity.ext.nunit" : " 1.0.5" ,
9
8
"com.unity.ide.rider" : " 1.1.4" ,
10
9
"com.unity.ide.vscode" : " 1.2.3" ,
11
- "com.unity.multiplayer-hlapi" : " 1.0.6" ,
12
10
"com.unity.purchasing" : " 2.1.1" ,
13
- "com.unity.test-framework" : " 1.1.19" ,
14
11
"com.unity.textmeshpro" : " 2.0.1" ,
15
- "com.unity.timeline" : " 1.2.6" ,
16
12
"com.unity.ugui" : " 1.0.0" ,
17
- "com.unity.xr.legacyinputhelpers" : " 2.1.6" ,
18
13
"com.unity.modules.ai" : " 1.0.0" ,
19
14
"com.unity.modules.androidjni" : " 1.0.0" ,
20
15
"com.unity.modules.animation" : " 1.0.0" ,
Original file line number Diff line number Diff line change 39
39
},
40
40
"com.unity.ext.nunit" : {
41
41
"version" : " 1.0.5" ,
42
- "depth" : 0 ,
42
+ "depth" : 2 ,
43
43
"source" : " registry" ,
44
44
"dependencies" : {},
45
45
"url" : " https://packages.unity.com"
60
60
"dependencies" : {},
61
61
"url" : " https://packages.unity.com"
62
62
},
63
- "com.unity.multiplayer-hlapi" : {
64
- "version" : " 1.0.6" ,
65
- "depth" : 0 ,
66
- "source" : " registry" ,
67
- "dependencies" : {
68
- "nuget.mono-cecil" : " 0.1.6-preview"
69
- },
70
- "url" : " https://packages.unity.com"
71
- },
72
63
"com.unity.purchasing" : {
73
64
"version" : " 2.1.1" ,
74
65
"depth" : 0 ,
80
71
},
81
72
"com.unity.test-framework" : {
82
73
"version" : " 1.1.19" ,
83
- "depth" : 0 ,
74
+ "depth" : 1 ,
84
75
"source" : " registry" ,
85
76
"dependencies" : {
86
77
"com.unity.ext.nunit" : " 1.0.5" ,
98
89
},
99
90
"url" : " https://packages.unity.com"
100
91
},
101
- "com.unity.timeline" : {
102
- "version" : " 1.2.6" ,
103
- "depth" : 0 ,
104
- "source" : " registry" ,
105
- "dependencies" : {},
106
- "url" : " https://packages.unity.com"
107
- },
108
92
"com.unity.ugui" : {
109
93
"version" : " 1.0.0" ,
110
94
"depth" : 0 ,
114
98
"com.unity.modules.imgui" : " 1.0.0"
115
99
}
116
100
},
117
- "com.unity.xr.legacyinputhelpers" : {
118
- "version" : " 2.1.6" ,
119
- "depth" : 0 ,
120
- "source" : " registry" ,
121
- "dependencies" : {},
122
- "url" : " https://packages.unity.com"
123
- },
124
- "nuget.mono-cecil" : {
125
- "version" : " 0.1.6-preview" ,
126
- "depth" : 1 ,
127
- "source" : " registry" ,
128
- "dependencies" : {},
129
- "url" : " https://packages.unity.com"
130
- },
131
101
"com.unity.modules.ai" : {
132
102
"version" : " 1.0.0" ,
133
103
"depth" : 0 ,
You can’t perform that action at this time.
0 commit comments