随笔分类 -  u3d

摘要:private float rotateSpeed = 0; private int maxSpeed = 1500; private bool speedUp = false; //旋转状态,加速,减速 // Start is called before the first frame updat 阅读全文
posted @ 2024-07-20 16:56 暖暖De幸福 阅读(34) 评论(0) 推荐(0)
摘要:[Tooltip("严格按照红、黄、绿排序")] public Material[] colors; int index = 0; // Start is called before the first frame update void Start() { ChangeColor(); } // 阅读全文
posted @ 2024-07-20 16:56 暖暖De幸福 阅读(15) 评论(0) 推荐(0)
摘要:InvokeRepeating 和 Invoke public Material[] colors; float speed = 5; // Start is called before the first frame update void Start() { //Invoke("AutoChan 阅读全文
posted @ 2024-07-20 16:29 暖暖De幸福 阅读(15) 评论(0) 推荐(0)
摘要:获取父节点 var transform = gameObject.transform.parent; // 获取父级的变换组件 var parent = gameObject.transform.parent.gameObject; //获取父级节点 Debug.Log(parent.name); 阅读全文
posted @ 2024-07-16 21:24 暖暖De幸福 阅读(17) 评论(0) 推荐(0)
摘要:public class CubeLogic : MonoBehaviour { // Start is called before the first frame update void Start() { } // Update is called once per frame void Upd 阅读全文
posted @ 2024-07-15 21:10 暖暖De幸福 阅读(15) 评论(0) 推荐(0)
摘要:当 GameObject 要访问其它对象上的组件时,有下面两种方法 方法一(推荐) public class MainLogic : MonoBehaviour { public AudioSource bgm; // Start is called before the first frame u 阅读全文
posted @ 2024-07-15 20:34 暖暖De幸福 阅读(24) 评论(0) 推荐(0)
摘要:public GameObject targetGameObject; [Tooltip("移动速度")] public float speed = 0.02f; private void Awake() { Application.targetFrameRate = 60; } // Start 阅读全文
posted @ 2024-07-14 20:50 暖暖De幸福 阅读(24) 评论(0) 推荐(0)
摘要:参数的用法 参数必须为 public 参数名称即变量名 参数的默认值 参数的工具提示 [Tooltip("旋转速度")] public float rotateSpeed = 60f; // Start is called before the first frame update void Sta 阅读全文
posted @ 2024-07-14 20:32 暖暖De幸福 阅读(26) 评论(0) 推荐(0)
摘要:调置旋转角度时,一般使用 localEulerAngles ,而不是 rotation 给物体调转一个旋转角度。 1、 Quaternion 四元组 ( x, y, z, w ) transform.rotation = ... 不便操作,官方不建议使用 2、欧拉角 Euler Angle tran 阅读全文
posted @ 2024-07-14 15:20 暖暖De幸福 阅读(34) 评论(0) 推荐(0)