public void OnClearButtonClicked() { Gamepiece g = FieldDataHandler.gamepieces[gamepieceIndex]; GameObject[] gameObjects = GameObject.FindObjectsOfType <GameObject>(); dpmRobot.DestroyAllHeld(true, g.name); foreach (GameObject o in gameObjects.Where(o => o.name.Equals(g.name + "(Clone)"))) { GameObject.Destroy(o); } }
/// <summary> /// Clear gamepiece clones /// </summary> public void OnClearButtonClicked() { Gamepiece g = FieldDataHandler.gamepieces[gamepieceIndex]; GameObject[] gameObjects = GameObject.FindObjectsOfType <GameObject>(); dpmRobot.DestroyAllHeld(true, g.name); //destroy clones held by robot //Destory all clones foreach (GameObject o in gameObjects.Where(o => o.name.Equals(g.name + "(Clone)"))) { GameObject.Destroy(o); } AnalyticsManager.GlobalInstance.LogEventAsync(AnalyticsLedger.EventCatagory.DPMTab, AnalyticsLedger.EventAction.Clicked, "Clear Gamepiece", AnalyticsLedger.getMilliseconds().ToString()); }