Search Unity

Physics objects disapear from view when play

Discussion in 'Physics for ECS' started by Worktrainer, Jan 9, 2020.

  1. Worktrainer

    Worktrainer

    Joined:
    Dec 2, 2019
    Posts:
    5
    It can be me, but what ever I try I cannot get Unity Physics to work. I watched the instuction video on this forum and it is super simple. I created a box floor 10,1,10 added shape, body(static) and convert to entity components. Added a sphere in the air added the same components but body is dynamic. In the video this is all what is needed to for a simple physics simulation.

    Whats happens is that when I press play the object disapear from scene view but are shown in entity Debugger.
    I try this on different computers with (2019.3) (2019.2.17) and everytime I get this same behaviour.

    It drives me crazy :confused: is it my issue of a Unity issue?
     
  2. steveeHavok

    steveeHavok

    Joined:
    Mar 19, 2019
    Posts:
    481
    In the entity debugger, can you see the translation of the sphere changing?
     
    Worktrainer likes this.
  3. sstrong

    sstrong

    Joined:
    Oct 16, 2013
    Posts:
    2,255
    I had similar issues when there were colliders on child gameobjects of the prefab being converted. It would appear in the entity debugger but not render in the scene. The only workaround I found was to move the colliders up to the parent gameobject of the prefab. Here is a code snippet for my workaround of disabling any child colliders:
    Code (CSharp):
    1. Transform myPrefab;
    2. ...
    3. myPrefab.GetComponentsInChildren<Collider>(colliderList);
    4.  
    5. int numColliders = colliderList == null ? 0 : colliderList.Count;
    6.  
    7. for (int clIdx = 0; clIdx < numColliders; clIdx++)
    8. {
    9.     Collider collider = colliderList[clIdx];
    10.     // Ignore colliders on the parent
    11.     if (collider.transform != myPrefab)
    12.     {
    13.         if (collider.enabled) { collider.enabled = false; }
    14.         //Debug.Log("[DEBUG] collider: " + collider.name);
    15.     }
    16. }
     
    Worktrainer likes this.
  4. Adam-Mechtley

    Adam-Mechtley

    Administrator

    Joined:
    Feb 5, 2007
    Posts:
    290
    I assume you also have installed the hybrid renderer package?
     
    Worktrainer and steveeHavok like this.
  5. Worktrainer

    Worktrainer

    Joined:
    Dec 2, 2019
    Posts:
    5
    You are a Hero! That was the issue.

    Thanks for all the other tips ;)
     
    Adam-Mechtley likes this.