当前位置:网站首页>Unity3d learning notes
Unity3d learning notes
2022-07-07 07:01:00 【Tool man of konjaku】
C# Basics
// Input
int.parse(Console.ReadLine());
// Output
Console.WriteLine();
Pass in object x
Person xiaoming = object x as Person
unity3d
Class inheritance in the script has three default functions
Awake() Start() Update()
And variables
Commonly used gameObject,transform…
translation
transform.Translate(Vector3. up * Time. deltaTime)
rotate
Show
setActive(boolean)
tip: Shortcut key Ctrl+N New scene
API
The coordinate is a three-dimensional vector
To obtain position , size , Rotating information
transform.position、rotation、localScale
Get other objects
Object object= GameObject.Find(" Object name ");
Object object= GameObject.FindWithTag(" Object tag name ");
Get components
Component comp=gameObject.GetComponent<>()
Calling method
Invoke("Func", 1.0); //1s Post trigger Func function
call ( Other objects ) Method
SendMessge() command : One calls instructions on other objects ( That is, the function in the script on the object ) Methods
Instantiate an object ( Copy )
Instantiate(object, transform.position, rotation);
Destruction of objects
Destroy(gameObject,3.0); // 3 Destroy the object in seconds
Collision events
If Is Trigger Option is checked , Once the object collides , No physical interaction , Will produce 3 Collision information is sent to the script parameters , Namely OnTriggerEnter、OnTriggerExit、OnTriggerStay. It is often used in picking and other events .
Rewriting methods
Collider callback method :( stop )
// The collision begins
void OnCollisionEnter(Collision other)
// During the collision , Once per frame
void OnCollisionStay(Collision other)
// End of collision
void OnCollisionExit(Collision other)
Trigger callback method :
// Trigger start
void OnTriggerEnter(Collider other)
// During triggering , Once per frame
void void OnTriggerStay(Collider other)
// Trigger end
void OnTriggerExit(Collider other)
Input
边栏推荐
猜你喜欢
LC 面试题 02.07. 链表相交 & LC142. 环形链表II
String (explanation)
场馆怎么做体育培训?
.net 5 FluentFTP连接FTP失败问题:This operation is only allowed using a successfully authenticated context
多个kubernetes集群如何实现共享同一个存储
服装门店如何盈利?
健身房如何提高竞争力?
学术报告系列(六) - Autonomous Driving on the journey to full autonomy
How can gyms improve their competitiveness?
Abnova循环肿瘤DNA丨全血分离,基因组DNA萃取分析
随机推荐
【mysqld】Can't create/write to file
使用net core优势/为什么使用
MySQL (x)
How to install swoole under window
Anr principle and Practice
【JDBC以及内部类的讲解】
SolidWorks GB Library (steel profile library, including aluminum profile, aluminum tube and other structures) installation and use tutorial (generating aluminum profile as an example)
How to share the same storage among multiple kubernetes clusters
企業如何進行數據治理?分享數據治理4個方面的經驗總結
基于JS的迷宫小游戏
MySQL view bin log and recover data
Config分布式配置中心
循环肿瘤细胞——Abnova 解决方案来啦
Mysql---- import and export & View & Index & execution plan
Complete process of MySQL SQL
常用函数detect_image/predict
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第二阶段答案
MOS tube parameters μ A method of Cox
Learning records on July 4, 2022
一文带你了解静态路由的特点、目的及配置基本功能示例