摘要:使用PlayerPrefs PlayerPrefs.SetString(str:sring, str1:string);//保存字符串,以键值对的形式存储数据 PlayerPrefs.SetInt(str:string, num:int);//保存整型 PlayerPrefs.SetFloat(st
阅读全文
摘要:实现摄像机根据鼠标绕游戏对象旋转 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Scripts_07_11 : MonoBehaviour { public Tr
阅读全文
摘要:按键检测 Input.GetKeyDown(KeyCode.W);//检测按键是否按下(是指的按下的一瞬间状态),这里是是否按下w Input.GetKeyUp(KeyCode.W);//检测按键是否抬起(是指的抬起的一瞬间状态),这里是检测的w Input.GetKey(KeyCode.W);//
阅读全文
摘要:添加属性 //添加刚体特性 obj:GameObject.AddCompoent<RigidBody>(); //添加链条关节 HingeJoint joint = obj:GameObject.AddCompoent<HingeJoint>();//添加组件并获取它 joint.connected
阅读全文
摘要:GameObject.CreatPrimitive(obj:Primitive type);//创建GameObject对象 GameObject.Find(name:string);//找到名字为name的对象 GameObject.FindGameObjectsWithTag(name:stri
阅读全文
摘要:GUI控件 GUI.Label(postion:Rect, text:string);//显示文本 GUI.Box(postion:Rect, text:string/image:Texture, style:GUIStyle);//绘制一个盒子,里面可以放文本,图片,后面的第三个参数样式可以不填
阅读全文