当前位置:网站首页>Unity C: use this keyword to expand class functions
Unity C: use this keyword to expand class functions
2022-07-22 10:14:00 【qq_ forty-two million nine hundred and eighty-seven thousand ni】
Sometimes we want to give unity Medium button perhaps gameobject Customize some tool class functions , At this time, you can define a special static tool class to host these static tool functions , The specific implementation is as follows :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Test: MonoBehaviour
{
void Start()
{
gameObject.SetActiveEx(true);
}
}
public static class GameObjectExtension// Must be a static class
{
public static void SetActiveEx(this GameObject g, bool t)
{
if (null == g) return;
g.SetActive(t);
}
}
After declaring the static extension function IDE This function will be automatically prompted for us , The development efficiency can be effectively improved by customizing the expansion function .
边栏推荐
- C# 与CAD二次开发,20220721随笔代码
- Redis client integration Prometheus indicators
- Web crawler crawls the inspirational bullet screen of station B and generates word cloud (careful note summary)
- Vinco ventures appoints Ted Farnsworth as co CEO
- 初识 JS
- Set set
- abaqus 中英文转换
- 从 Google 离职,前Go 语言负责人跳槽小公司
- 黑马瑞吉外卖之后台登录与退出功能开发
- 罐子(kuangbin专题)
猜你喜欢
Flutter教程之sqlite_wrapper新的 Dart 和 Flutter 库,用于 SQLite
Ingress
这项比赛有点逆天!鲲鹏应用创新大赛openEuler赛道全面开启
AutoJs学习-实现文件下载进度
Asemi rectifier bridge lb10s parameters, lb10s characteristics, lb10s mechanical data
"Everything is interconnected, enabling thousands of industries", the 2022 open atom global open source summit openatom openharmony sub forum is about to open
Why are there career bottlenecks for test / development programmers? It seems that everything has changed
Différences entre les liens durs et les liens souples de rhcsa, interprétation des répertoires de premier niveau, redirection, création de fichiers et de répertoires, suppression de fichiers et de rép
Crazy God redis notes 07
Equal principal increasing repayment / equal principal decreasing mortgage repayment calculator
随机推荐
C # and CAD secondary development, 20220721 essay code
行内元素、块级元素、空元素分别有哪些?
Live broadcast preview │ special session of Zhihui Yunzhou "digital twin smart Park solutions"
RHCSA 压缩也解压缩、tar归档命令、文件的上传与下载、sehll中的变量、命令别名、命令历史
软件测试过程的持续改进
Différences entre les liens durs et les liens souples de rhcsa, interprétation des répertoires de premier niveau, redirection, création de fichiers et de répertoires, suppression de fichiers et de rép
DaVinci resolve 18, a video editing and color matching software, was officially released
短视频直播源码,uniapp跳转页面携带id
网络爬虫爬取b站励志弹幕并生成词云(精心笔记总结)
unity scrollview滚动到指定的位置
tsconfig. JSON cannot find any input in the configuration file. What should I do?
父元素visibility:hidden;子元素设置visibility:visible,子元素显示吗
HCIP(10)
MxCAD5.2 20190704更新
ASEMI整流桥LB10S参数,LB10S特性,LB10S机械数据
高度关注,2022开放原子开源峰会最新议程一览
openEuler志高远,开源汇智创未来 | 2022开放原子全球开源峰会 openEuler 分论坛即将开幕
Recommend the source code of the finished live broadcast, and set the system date, time and time zone
直播预告 | NFT, AIGC/UGC工具与元宇宙产品带来的新的设计创意与生产方法
[gestionnaire de projet du système d'information] chapitre IV Structure globale des connaissances en gestion