Search Unity

Collision problem with prefab

Discussion in 'Physics' started by unity_SSC_MANOB, Oct 5, 2021.

  1. unity_SSC_MANOB

    unity_SSC_MANOB

    Joined:
    Jun 27, 2018
    Posts:
    2
    I have 3 game objects in my game
    1. Player
    2. Coin ( prefab)
    3. Enemy
    In physics setting I enable player & coins , player & enemy collision on. But never collision with coin but enemy. If I enable collision between coin & enemy collision happen. I didn't find any setting mistake but I don't know why player and coin not collided.
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,445
    Tell us a little more about how you enable those collisions, and how you instantiate items. Do you put all the coins and enemies into the scene manually, or do you
    Instantiate()
    them? If you pause the game before collisions, can you check what physics layer(s) each type of gameobject is on?
     
  3. unity_SSC_MANOB

    unity_SSC_MANOB

    Joined:
    Jun 27, 2018
    Posts:
    2
    I use deferent layer for enemy, player and coin. Player and enemy manually added and coin is Instantiate()
     
  4. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,445
    Okay, that answers part of my questions. After
    Instantiate()
    are you assigning any new value to the new instance's
    .layer
    property? Can you confirm the layers of instantiated coins by pausing during the game and inspecting them?