- Home /
Question by
Chocolade · Dec 05, 2016 at 03:11 AM ·
c#scripting problemscript.
How can i List objects by name but also in small text or big text or any kind ?
static void FixPlaneNames(string planeName)
{
if (string.IsNullOrEmpty(planeName))
{
planeName = "Plane";
}
List<GameObject> planes = (from g in UnityEngine.Object.FindObjectsOfType<GameObject>() where g.name.Contains(planeName) select g).ToList();
}
But this will not get for example objects that the name is plaNe or plane or PLANE or plane or pLaNe
How can i make that it will get all the cases plane is written ?
Comment
Best Answer
Answer by flashframe · Dec 05, 2016 at 03:21 AM
Try converting the text to lowercase before comparing it:
where g.name.ToLower().Contains(planeName.ToLower())
Your answer
Follow this Question
Related Questions
How can i change the walls height and keep the size for example 100x100 but height 0.1 ? 1 Answer
Why i'm getting UnassignedReferenceException when running the game ? 1 Answer
How can i make the spaceship to land/take off with physics vertical ? 2 Answers
To pass a variable between scenes should I use scriptableobject or static ? 1 Answer
How can i prevent from mouse to collide with thirdpersoncontroller ? 0 Answers