Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

When I use the ECS system, I encountered a problem that is how to convert from gameobject to Entity?

Discussion in 'Physics' started by Bob_work, Apr 23, 2021.

  1. Bob_work

    Bob_work

    Joined:
    May 5, 2020
    Posts:
    113
    If I use GameObject I can write like this :
    GameObject gameObject = hitinfo.collider.gameObject;

    //after some operation ......

    then I can write this to get parent object from the "GameObject", i.e. :
    MyObject = gameObject.GetComponentInParent<MyBehaviour>();

    Now I wanna use ECS, so how can I solve this dependency relationships? If ECS has no dependency like original, how can I get my target object from ECS?

    Unity official please answer me, thanks a lot.

    by the way, how to use Raycast(), ScreenPointToRay(), etc, still like original? But they are contain many GameObjects ! How the ECS solve these problems?
    Thanks.
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,315
  3. Bob_work

    Bob_work

    Joined:
    May 5, 2020
    Posts:
    113
    Thank you!
     
    MelvMay likes this.
  4. Bob_work

    Bob_work

    Joined:
    May 5, 2020
    Posts:
    113
    hi MelvMay,
    Could you please help me to consult with your colleagues in the DOTS group? Question:https://forum.unity.com/threads/whe...to-convert-from-gameobject-to-entity.1097995/
    I finally updated the question on how to use ConfigurableJoint in ECS. A lot of Vector3 and GameObject are used in "Jonit", and these are not supported in ECS! How can I modify the code so that they can be used in ECS? Thank you!
     
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,315
    Sorry but messaging me directly won't get you a fast-track to answers or changes as I have nothing whatsoever to do with that aspect of the engine. Posting in that forum is the best thing to do.
     
  6. Bob_work

    Bob_work

    Joined:
    May 5, 2020
    Posts:
    113
    Ok Got it