接物体的工具 using UnityEngine; using System.Collections; public class Tool : MonoBehaviour { float hor; Vector3 moveDir; public float moveSpeed = 3f; ; void Update() { hor = Input.GetAxis ("Horizontal"); //获取移动方向向量 moveDir = hor * Vector3.right; //移动
在我们做项目的过程中 经常会有预设中出现空的脚本 例如: 导致的原因是因为 脚本的丢失 现在我们来做一个检查工程中有空脚本的预设工具 老规矩直接上代码 放到工程就能用 using UnityEngine; using UnityEditor; using System.IO; using System.Collections.Generic; public class PrefabTool : EditorWindow { [MenuItem("Prefab Tool/Check Missing