Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. 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:
    108
    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:
    10,343
  3. Bob_work

    Bob_work

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

    Bob_work

    Joined:
    May 5, 2020
    Posts:
    108
    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:
    10,343
    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:
    108
    Ok Got it