Quantcast
Channel: Questions in topic: "finding"
Viewing all articles
Browse latest Browse all 73

List.FindIndex

$
0
0
How works FindIndex? public class FRef : MonoBehaviour { string player_n; public List p = new List(); int idx; void Start() { idx = p.FindIndex(IsAlive); Debug.Log(p[idx].name); } bool IsAlive(Prop stats) { return stats.health == 100; } } And class.cs: using UnityEngine; using System.Collections; using System; public class Classes { } [Serializable] public class Prop { public string name; public int health; } I understood what this code does but I was wondering about "FindIndex". It is very strange. Please help.

Viewing all articles
Browse latest Browse all 73

Trending Articles