Может кто подсказать, что это за вид конструкции, я с ней вообще не знаком (напоминает чем-то шаблоны из С++, но с ними я пока тоже не знаком):
Синтаксис:
Используется csharp
static public T FindInParents<T>(GameObject go) where T : Component
{
if (go == null) return null;
var comp = go.GetComponent<T>();
if (comp != null)
return comp;
Transform t = go.transform.parent;
while (t != null && comp == null)
{
comp = t.gameObject.GetComponent<T>();
t = t.parent;
}
return comp;
}
{
if (go == null) return null;
var comp = go.GetComponent<T>();
if (comp != null)
return comp;
Transform t = go.transform.parent;
while (t != null && comp == null)
{
comp = t.gameObject.GetComponent<T>();
t = t.parent;
}
return comp;
}
Код скопирован из справки. Мне не понятен синтаксис, хочу об этом почитать. Направьте, пожалуйста.