当前位置:网站首页>unity 功能扩展
unity 功能扩展
2022-04-23 20:45:00 【夏炎黄】
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>();
}
}
版权声明
本文为[夏炎黄]所创,转载请带上原文链接,感谢
https://blog.csdn.net/XYH_78/article/details/124321085
边栏推荐
- 缓存淘汰算法初步认识(LRU和LFU)
- 常用60类图表使用场景、制作工具推荐
- go defer
- C migration project record: modify namespace and folder name
- BMP JPEG picture to vector image contourtrace
- Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
- On IRP from the perspective of source code
- Solve the Chinese garbled code of URL in JS - decoding
- MySQL基础之写表(创建表)
- MySQL进阶之表的增删改查
猜你喜欢
LeetCode 116. 填充每个节点的下一个右侧节点指针
"Meta function" of tidb 6.0: what is placement rules in SQL?
Devaxpress report replay: complete the drawing of conventional two-dimensional report + histogram + pie chart
DOS command of Intranet penetration
Latex formula
Resolve the eslint warning -- ignore the warning that there is no space between the method name and ()
MySQL基础之写表(创建表)
Elastic box model
3-5 obtaining cookies through XSS and the use of XSS background management system
笔记本电脑卡顿怎么办?教你一键重装系统让电脑“复活”
随机推荐
Latex formula
Vscode download speed up
go struct
laravel 发送邮件
LeetCode 232、用栈实现队列
pikachuxss如何获取cookie靶场,返回首页总是失败
Unity asset import settings
UKFslam
Common commands of MySQL in Linux
UnhandledPromiseRejectionwarning:CastError: Cast to ObjectId failed for value
Queue template code
go slice
电脑越用越慢怎么办?文件误删除恢复方法
Resolve the error - error identifier 'attr_ id‘ is not in camel case camelcase
MySQL数据库常识之储存引擎
JS arrow function user and processing method of converting arrow function into ordinary function
Leetcode 1337. Row K with the weakest combat effectiveness in the matrix
Shanghai responded that "flour official website is an illegal website": neglect of operation and maintenance has been "hacked", and the police have filed a case
The more you use the computer, the slower it will be? Recovery method of file accidental deletion
3-5 obtaining cookies through XSS and the use of XSS background management system