public static void killProjectile(GameObject player) { switch (player.tag) { case "PlayerOneProjectile": p1CanShoot = true; ionPlacement.cannotPlacePositive = origPosIon; // After the the shot is done, ionPlacement.cannotPlaceNegative = origNegIon; // Return placement to original. break; case "PlayerTwoProjectile": p2CanShoot = true; break; } trailRenderer = player.transform.FindChild("TrailRenderer").gameObject; currentPosition = trailRenderer.transform.position; trailRenderer.transform.SetParent(canvas.transform); trailRenderer.transform.position = currentPosition; renderers.Add(trailRenderer); Destroy(player.gameObject); //Destroyes the player and updates the score if (PlayerManager.numberOfPlayers == 1) { attempts.Attempted(); } }