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.
↧