当前位置:网站首页>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
边栏推荐
- The latest trends of data asset management and data security at home and abroad
- What books can greatly improve programming ideas and abilities?
- 华为机试题素数伴侣
- 2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书第二阶段答案
- 途家、木鸟、美团……民宿暑期战事将起
- Bus message bus
- Tool class: object to map hump to underline underline hump
- Initial experience of addresssanitizer Technology
- Redhat5 installing vmware tools under virtual machine
- 二十岁的我4面拿到字节跳动offer,至今不敢相信
猜你喜欢
This article introduces you to the characteristics, purposes and basic function examples of static routing
Maze games based on JS
循环肿瘤细胞——Abnova 解决方案来啦
企業如何進行數據治理?分享數據治理4個方面的經驗總結
Bus message bus
Master-slave replication principle of MySQL
CompletableFuture使用详解
Matlab tips (30) nonlinear fitting lsqcurefit
MOS管参数μCox得到的一种方法
SVN version management in use replacement release and connection reset
随机推荐
MySQL (x)
Performance comparison between Ceres solver and g2o
2022/07/04学习记录
MOS tube parameters μ A method of Cox
Tool class: object to map hump to underline underline hump
Abnova循环肿瘤DNA丨全血分离,基因组DNA萃取分析
MOS管参数μCox得到的一种方法
How to share the same storage among multiple kubernetes clusters
ip地址那点事
根据IP获取地市
How to do sports training in venues?
Navicat importing 15g data reports an error [2013 - lost connection to MySQL server during query] [1153: got a packet bigger]
Anr principle and Practice
Several index utilization of joint index ABC
学术报告系列(六) - Autonomous Driving on the journey to full autonomy
AddressSanitizer 技术初体验
unity3d学习笔记
Please tell me how to monitor multiple schemas and tables by listening to PgSQL
Brand · consultation standardization
途家、木鸟、美团……民宿暑期战事将起