|
Post by jacobjones on Sept 30, 2017 5:23:59 GMT
Hello I am getting garabge with PoolBoss.Despawn. Specifically with GetPrefabName(), within that it is String.substring, string.substringunchecked, and string.internalAllocateStr() and Object.get_name. It is a pretty big spike. Any idea what might be causing this and how to fix it? I must be Depawning incorrectly because I am also getting it all over the place. Here is an example of what im doing. Im also getting spikes from GameObject.SetActive and GameObject.Deativate sometimes with garbage sometimes without. private void OnTriggerEnter(Collider other) { if (other.CompareTag("BasicBlack")) { //Checking to make sure its not on the border if (transform.position.x < (gridGenerator.mapSize.x / 2) - 2 && (transform.position.z < (gridGenerator.mapSize.y / 2) - 2 && transform.position.x > (gridGenerator.mapSize.x / 2) * -1 + 2 && transform.position.z > (gridGenerator.mapSize.y / 2) * -1 + 2 && otherBlack.priorityNumber < priorityNumber)) { Transform tBG = PoolBoss.SpawnInPool(blackGunnerPrefab.transform, roundedPos, Quaternion.identity); BlackGunner bg = tBG.GetComponent<BlackGunner>(); bg.growthStep = 0; bg.blackMasterController = blackMasterController; PoolBoss.Despawn(other.transform); PoolBoss.Despawn(transform); } } Thanks Jacob 
|
|
|
Post by DarkTonic Dev on Sept 30, 2017 5:55:54 GMT
That's what happens for us to get the "non-clone" name of the game object. If you already happen to know what that is, you can pass it in as the 2nd parameter of the Despawn call, and it won't need to do string operations to figure it out.
i.e.
PoolBoss.Despawn(this.transform, "Arrow");
|
|
|
Post by DarkTonic Dev on Sept 30, 2017 5:57:36 GMT
I will investigate if there's a way to get around this automatically for a future update.
|
|
|
Post by jacobjones on Sept 30, 2017 6:31:14 GMT
Thanks for the quick reply, fixed it right up
|
|
|
Post by DarkTonic Dev on Sept 30, 2017 18:16:12 GMT
No problem.
|
|