- Home /
How to return the first Texture from a List given a texture name (string) using Linq?
I have a generic list of texture List and I need to find the very first ones from the results given a texture name = "robot_desert" for example.
Is it doable in unity?
Comment
Best Answer
Answer by Bunny83 · Sep 01, 2015 at 11:04 PM
using System.Linq;
using System.Collections.Generic;
List<Texture2D> list;
Texture2D tex = list.Where(t=>t.name =="robot_desert").FirstOrDefault();
Your answer
![](https://koobas.hobune.stream/wayback/20220612002322im_/https://answers.unity.com/themes/thub/images/avi.jpg)