当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
Leetcode T1165: 日志分析
途家、木鸟、美团……民宿暑期战事将起
Prime partner of Huawei machine test questions
Problems and precautions about using data pumps (expdp, impdp) to export and import large capacity tables in Oracle migration
MySQL SQL的完整处理流程
2018年江苏省职业院校技能大赛高职组“信息安全管理与评估”赛项任务书
JDBC database connection pool usage problem
oracle如何备份索引
【mysqld】Can't create/write to file
MySQL user permissions
How Oracle backs up indexes
使用net core优势/为什么使用
Matlab tips (30) nonlinear fitting lsqcurefit
Master-slave replication principle of MySQL
Use of completable future
LC 面试题 02.07. 链表相交 & LC142. 环形链表II
Brand · consultation standardization
from .onnxruntime_pybind11_state import * # noqa ddddocr运行报错
Pinduoduo lost the lawsuit: "bargain for free" infringed the right to know but did not constitute fraud, and was sentenced to pay 400 yuan
from . onnxruntime_ pybind11_ State Import * noqa ddddocr operation error