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.
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.
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!