public void CheckAndMakeShuffle(bool force = false) { Debug.Log("Start CheckAndMakeShuffle."); int count = 0; foreach (Transform child in this.gameObject.transform.parent.parent) { if (child.gameObject.name == "ActivityManager") { count++; } } if (count > 1) { // There are multiple operations going, so skip checking return; } if (!puzzleBoard.CheckShuffle(force)) { return; } // Refresh all of the characters foreach (PuzzleCharacter character in puzzleBoard.PuzzleCharacters) { string key = GetCharacterKey(character.Index); var childTransform = this.gameObject.transform.Find(key); if (childTransform != null) { // Found it, move it to the current position var targetLocation = this.ConvertToPixelPosition(character.Position); var moveTo = childTransform.gameObject.AddComponent <MoveTo>(); moveTo.Initialize(targetLocation, 0.6f); } else { // Not found, create the object RenderPuzzleNode(character); } } }