using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using UnityEngine;
using TMPro;
using UnityEngine.UI;
public static class ExtensionMethod
{
public static TaskAwaiter GetAwaiter(this AsyncOperation asyncOperation)
{
var tcs = new TaskCompletionSource<object>();
asyncOperation.completed += obj => { tcs.SetResult(null); };
return ((Task)tcs.Task).GetAwaiter();
}
public static TextMeshProUGUI GetPlaceholder(this TMP_InputField tMP_InputField)
{
return tMP_InputField.placeholder.GetComponent<TextMeshProUGUI>();
}
public static TextMeshProUGUI Lable(this Toggle toggle)
{
TextMeshProUGUI textMeshProUGUI = toggle.transform.Find("Label").GetComponent<TextMeshProUGUI>();
return textMeshProUGUI;
}
public static Transform ToggleContent(this Toggle toggle)
{
return toggle.transform.Find("Content");
}
public static TextMeshProUGUI Placeholder(this TMP_InputField tMP_InputField)
{
return tMP_InputField.placeholder.GetComponent<TextMeshProUGUI>();
}
}
|