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. The 2023.1 beta is now available for testing. To find out what's new, have a look at our 2023.1 feature highlights.
    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:
    5
    how to select 3d object on web? raycast can not work.
     
  2. kazuki_unity729

    kazuki_unity729

    Unity Technologies

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

    GEESCAN

    Joined:
    Aug 17, 2015
    Posts:
    5
    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:
    581
    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:
    5
    Last edited: Jan 7, 2022
  6. kazuki_unity729

    kazuki_unity729

    Unity Technologies

    Joined:
    Aug 2, 2018
    Posts:
    581
  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