Bug.. Maybe?

Well, I’ve been trying to create a powerup in my little runner game that makes coins come toward me. Kind of like a magnet. While I’ve gotten all of that done, it seems that I am getting a little glitch every time the coroutine has ended. The spheres (placeholder gameobjects for the coins I will be using), end up unproportioned. Seriously weird… I thought it may have something to do with the fact that I have a cylindrical world, but that isn’t it. I know this because I unparent the spheres from the world once the coroutine starts… Does anyone know the reasoning behind this problem?

Here’s what’s happening:

You can see that the coin to the left (kind of behind the blue ball), is still somewhat proportioned right. The coin to the right, however, has changed size…

Here’s the code for the coins:

using UnityEngine;
using System.Collections;

public class Currency : MonoBehaviour {
	
	public int Increment;
	
	private float x,y,z;
	private float zAxis;
	
	public float xOffset = 35f,
				 xOffset1 = 35f,
				 yOffset = 51.5f,
				 zOffset = 10,
				 zOffset1 = 15f;
	
	public GameObject Player;
	public float LodestoneSpeed = 0.01f;
	public GameObject Cylinder;
	
	void Awake(){
		
		Cylinder = GameObject.Find("Cylinder");
		Player = GameObject.Find("Player");
	}
	
	// Use this for initialization
	void Start () 
	{
		
		RandomPosition ();
	}
	
	// Update is called once per frame
	void Update () 
	{
		zAxis = transform.position.z;
		if (zAxis <= -35f)
		{
			RandomPosition();
		}
		
		if(GameMaster.LodeStone){
		 transform.parent = null;
		 transform.LookAt(Player.transform);
		 transform.Translate(Vector3.forward * Time.deltaTime * LodestoneSpeed);

		}
		else if(!GameMaster.LodeStone)
		{
			transform.Translate(0,0,0);
			transform.LookAt(null);
			transform.parent = Cylinder.transform;
		
		}
	}
	
	
		//Assign a random position along the X axis, but within the players perspective.
		void RandomPosition()
	{
		transform.rotation = Quaternion.identity;
		x = Random.Range(PlayerMove.xAxis - xOffset , PlayerMove.xAxis + xOffset1);
		y = yOffset;
		z = Random.Range (zOffset,zOffset1);
		transform.position = new Vector3(x,y,z);
	}
	
	//Collision event
	void OnTriggerEnter(Collider otherObject1)
	{
		if (otherObject1.tag == "Player")
		{
			
			GameMaster.playCoins += Increment;
			//GameMaster.nGameCoins+=Increment;
			
			float nTemp = PlayerPrefs.GetFloat("TotalCoin");
			//print("before: "+nTemp);
			PlayerPrefs.SetFloat("TotalCoin", nTemp+Increment);
			//print("Coins picked up: "+(nTemp+Increment));
				
			RandomPosition();
		}
	}
}

Here’s the code for the powerup:

using UnityEngine;
using System.Collections;

public class LodeStone : MonoBehaviour {
	
	private float x,y,z;
	private float zAxis;
	
	public float xOffset = 35f,
				 xOffset1 = 35f,
				 yOffset = 51.5f,
				 zOffset = 10,
				 zOffset1 = 15f;
	
	public float Length = 1f;
	
	void Awake(){
	}
	
	// Use this for initialization
	void Start () 
	{

		RandomPosition ();
	}
	
	// Update is called once per frame
	void Update () 
	{
		zAxis = transform.position.z;
		if (zAxis <= -50)
		{
			RandomPosition();
		}
	}
	
	
		//Assign a random position along the X axis, but within the players perspective.
		void RandomPosition()
	{
		transform.rotation = Quaternion.identity;
		x = Random.Range(PlayerMove.xAxis - xOffset , PlayerMove.xAxis + xOffset1);
		y = yOffset;
		z = Random.Range (zOffset,zOffset1);
		transform.position = new Vector3(x,y,z);
	}
	
	//Collision event
	void OnTriggerEnter(Collider otherObject1)
	{
		if (otherObject1.tag == "Player")
		{
			StartCoroutine(moonStone());
		}
	}
	
		IEnumerator moonStone()
	{
		GameMaster.LodeStone = true;
		yield return new WaitForSeconds(Length);
		GameMaster.LodeStone = false;
		
	}
}

Pretty much, they are supposed to unchild from the cylinder, look at the player, and then move forward, when GameMaster.LodeStone returns true.

in the end of your enumerator try putting a return statement, because it will skik that last statement setting it to false so you might need to change the order or something