Instantiate prefab disables Circle Collider 2D

Dear Unity Community,

I am trying to pick up objects and then automatically create new objects by using Instantiate. This all works, but 2 things are going wrong.

  1. The size of the prefab seems to be smaller. When I add the prefab to the scene manually or it is inserted automatically by the instantiate , the object is 3 times smaller then the original prefab. Nothing in my code refers to the size of the object.

  2. The Circle Collider 2D is unchecked whenever the new object is created. I already tried:

    					CircleCollider2D coinCollider = UpgradeCoinPrefab.GetComponent<CircleCollider2D>();
    					coinCollider.enabled = true;
    

But it is still unchecked when it is created.

This is my Instantiate code:

createNewBlocks createNewBlocks = Player.GetComponent<createNewBlocks> ();
var newCoin = Instantiate (UpgradeCoinPrefab, new Vector2 (createNewBlocks.XPosition + 35, yPosition), Quaternion.identity);
newCoin.name = ("upgradeCoin" + playerSettings.CurrentCoins);

I hope somebody can help me out!

Kind Regards,

Marijn

  1. check scale property of your object the you want to instantiate.

2)if you manualy enable the circle collider in your object and save prefab, it’s impossible that turn off when you instantiate.
however, for enable circle collider use:

Example:

	    GameObject Coin = GameObject.FindWithTag ("Coin");

            Coin.collider2D.enabled = true;

yes for circle collider use collider2D.