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. We are updating our Terms of Service for all Unity subscription plans, effective October 13, 2022, to create a more streamlined, user-friendly set of terms. Please review them here:
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice
  4. Join us on Thursday, September 29, for a day with Unity's SRP teams here on the forum or on Reddit, and discuss topics around URP, HDRP, and the Scriptable Render Pipeline in general.
    Dismiss Notice

UI and masking 3d meshes in a scrollrect

Discussion in 'UGUI & TextMesh Pro' started by saarwii, Oct 1, 2015.

  1. CraftedGaming


    Jun 9, 2017
    You guys may want to try it out
    . Though, I'm not entirely sure how we can add it onto the UI.

    hi phil, can you guys update us on what we can do in the URP and HDRP? the solution posted here doesn't seem to work on the new render pipelines.

    I'm getting an error from the shader:
    Code (CSharp):
    1. Shader error in 'Universal Render Pipeline/Simple Lit': Couldn't open include file 'Packages/com.unity.render-pipelines.universal/Shaders/SimpleLitInput.hlsl'. at line 134
    larry2013z likes this.
  2. phil-Unity


    Unity UI Lead Developer Unity Technologies

    Nov 23, 2012
    Proper support of URP is coming. The basics have worked since day 1 but anything requiring lighting needs to be redone and they've just not gotten around to supporting it yet. I'm working with on of their devs to get URP full support into a release soon.

    As for you issue i'm not 100% sure as i'm not fully informed on how URP shaders are working.
    CraftedGaming likes this.
  3. MidnightCoffeeInc


    Feb 28, 2017
    I would love an update on this for URP, if there's a solution?
    I want to make a scrollrect with 3D objects.
  4. VitaliusSch


    Dec 7, 2013
    Hey All!
    I approached this question in a rather non-standard way. I hide the 3D meshes if they are not visible in the viewport. Maybe someone will come in handy:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    5. public class ScrollItemCtl : MonoBehaviour
    6. {
    7.     public RectTransform scrollViewViewport;
    8.     public GameObject go3dMesh;
    10.     Vector4 offset = new Vector4( 0, 17, 0, 20);
    12.     private void Update()
    13.     {
    14.         if (go3dMesh != null)
    15.             go3dMesh.SetActive(RectTransformUtility.RectangleContainsScreenPoint(scrollViewViewport, transform.position, null , offset));
    16.     }
    17. }
    Oh yeah .. you can add offsets to fine tune the hiding of objects.
    Last edited: Aug 3, 2021