Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

how to select 3d object in web? raycast can not work

Discussion in 'Unity Render Streaming' started by GEESCAN, Dec 30, 2021.

  1. GEESCAN

    GEESCAN

    Joined:
    Aug 17, 2015
    Posts:
    9
    how to select 3d object on web? raycast can not work.
     
  2. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
  3. GEESCAN

    GEESCAN

    Joined:
    Aug 17, 2015
    Posts:
    9
    nope, I mean use ray to check 3d object in scene:

    void Update()
    {
    if (Input.GetMouseButton(0))
    {
    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;
    if(Physics.Raycast(ray,out hit, 100f))
    {
    Destory(hit.collider.gameObject);
    }
    }
    }

    this work in editor,but can not work on web rendering ( RenderStreaming ).
     
  4. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
    You need to use Input System instead of legacy Input APIs.
    https://docs.unity3d.com/Packages/com.unity.inputsystem@1.3/manual/Migration.html
     
  5. GEESCAN

    GEESCAN

    Joined:
    Aug 17, 2015
    Posts:
    9
    Last edited: Jan 7, 2022
  6. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    803
  7. ysy_unity

    ysy_unity

    Joined:
    Mar 26, 2019
    Posts:
    2
    You can set the resolution of unity editor and web page to be the same value