Last active
May 4, 2017 20:18
-
-
Save neonima/2041a9cef63ad1b9ea8d0ce5a51c8f09 to your computer and use it in GitHub Desktop.
Revisions
-
Vincent Gschwend revised this gist
May 4, 2017 . 1 changed file with 0 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,6 @@ public bool InstiantiationCheck(GameObject GO, out GameObject instGo) foreach (GameObject go in ObjectPoolList) { if ( !ReferenceEquals(GO.GetComponent<PooledObject>(), null) && go.GetComponent<PooledObject>().nbrRef == GO.GetComponent<PooledObject>().nbrRef || GO.name.Equals(go.name) ) { instGo = go; -
Vincent Gschwend created this gist
May 4, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ public bool InstiantiationCheck(GameObject GO, out GameObject instGo) { instGo = null; foreach (GameObject go in ObjectPoolList) { if ( !ReferenceEquals(GO.GetComponent<PooledObject>(), null) && go.GetComponent<PooledObject>().nbrRef == GO.GetComponent<PooledObject>().nbrRef || GO.name.Equals(go.name) ) { instGo = go; return true; } } if(!GO.GetComponent<PooledObject>()) GO.AddComponent<PooledObject>(); GameObject temp = Instantiate(GO, ObjectPool.transform); PooledObject po = temp.GetComponent<PooledObject>(); po.name = po.name.Replace("(Clone)", ""); po.nbrRef = po.gameObject.GetHashCode(); GO.GetComponent<PooledObject>().nbrRef = po.nbrRef; po.mr = (GetComponent<MeshRenderer>()) ? GetComponent<MeshRenderer>() : GetComponentInChildren<MeshRenderer>(); ObjectPoolList.Add(po.gameObject); instGo = po.gameObject; return false; }