Search Unity

Unity UI ListPool<T> innaccessible due to protection level [Solved]

Discussion in 'UGUI & TextMesh Pro' started by jam-slc, Feb 26, 2018.

  1. jam-slc

    jam-slc

    Joined:
    Oct 18, 2016
    Posts:
    9
    Hello,

    I wanted to implement a variation on the Outline effect, but the Outline.cs from the Unity UI source does not compile in 5.5 or 5.6:

    The line that is failing is:
    Code (CSharp):
    1.  
    2. var verts = ListPool<UIVertex>.Get();
    3.  
    I get the same error if I try to use the BaseMeshEffect example code here or try using ListPool in any context.

    ListPool appears to be implemented like this:
    Code (CSharp):
    1.  
    2. namespace UnityEngine.UI {
    3.     internal static class ListPool<T> {
    4.         public static List<T> Get();
    5.         public static void Release(List<T> toRelease);
    6.     }
    7. }
    8.  
    Not sure how an internal static class is supposed to be used.

    Searching google/forums for the error didn't return anything, so I'm wondering what I could be missing!

    Thank you for any help or suggestions!

    _____

    Edit: Solved!

    By adding ListPool.cs & ObjectPool.cs into my project, the ListPool can now be used in custom scripts.
     
    Last edited: Feb 26, 2018
  2. arkogelul

    arkogelul

    Joined:
    Nov 14, 2016
    Posts:
    105
    Hi,

    I'm curious to know what you wanted to do off of this script. I'm trying to modify the shadow.cs script myself and don't really know where to go from here. Thanks to you I managed to get it modified (by adding the script you mentioned).

    I would like to make the shadow a solid color and not a blend of the original image.
    Right now, the color I pick (green) is multiply by the source image :

    And I would like it to be like that :


    If you have a track to follow, that would be awesome !
     
  3. Rugbug_Redfern

    Rugbug_Redfern

    Joined:
    Jun 2, 2017
    Posts:
    20
    The Unity UI bitbucket has been taken down, and this question is no longer solved. If anyone has the original ListPool.cs and ObjectPool.cs scripts, please send them as they are no longer public.
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Hey. We moved the pools into UnityEngine and made them public. They are available in 2021.1.
     
    AnKOu likes this.
  5. CSaratakij

    CSaratakij

    Joined:
    Jan 24, 2018
    Posts:
    2
    Can you please backport ListPool & ObjectPool to Unity2020 LTS?
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    CSaratakij likes this.