Unity3D各平台路径

参考自 https://blog.csdn.net/fuemocheng/article/details/80170524

Platform:UNITY_EDITOR_WIN

Application.dataPath:F:/ProjectName/Assets

Application.streamingAssetsPath:F:/ProjectName/Assets/StreamingAssets

Application.persistentDataPath:C:/User/username/AppData/LocalLow/CompanyName/ProjecName

Application.temporaryCachePath:C:/User/username/AppData/Local/Temp/CompanyName/ProjecName

Platform:STANDALONE_WIN

F:/Export/GameRoot/AppName.exe 应用所在路径

Application.dataPath: F:/Export/GameRoot/AppName_Data

Application.streamingAssetsPath: F:/Export/GameRoot/AppName_Data/StreamingAssets

Application.persistentDataPath: C:/Users/username/AppData/LocalLow/CompanyName/ProductName

Application.temporaryCachePath: C:/Users/username/AppData/Local/Temp/CompanyName/ProductName</

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
您可以使用以下代码在Unity中使摄像机沿着路径移动: ``` public class CameraPath : MonoBehaviour { public Transform[] waypoints; // 存储路径上的所有点 public float speed = 5.0f; // 镜头移动速度 public float waitTime = 1.0f; // 等待时间 private int currentWaypoint = 0; // 当前点的索引 private float currentSpeed = 0.0f; // 当前速度 private float currentWaitTime = 0.0f; // 当前等待时间 void Update() { if (currentWaitTime > 0) // 如果当前在等待时间内,则减少等待时间 { currentWaitTime -= Time.deltaTime; return; } if (currentWaypoint >= waypoints.Length) // 如果已经到达路径末尾,则重新开始路径 { currentWaypoint = 0; } if (currentWaypoint == waypoints.Length - 1) // 如果已经到达路径末尾,则等待一段时间再重新开始路径 { currentWaitTime = waitTime; } Vector3 target = waypoints[currentWaypoint].position; // 获取当前目标位置 transform.position = Vector3.MoveTowards(transform.position, target, currentSpeed * Time.deltaTime); // 移动到目标位置 if (transform.position == target) // 如果已经到达目标位置,则移动到下一个目标位置 { currentWaypoint++; currentSpeed = 0.0f; } else // 如果还未到达目标位置,则继续移动 { currentSpeed = speed; } } } ``` 在此示例中,我们存储路径上的所有点,并使用Transform.position和Vector3.MoveTowards方法在每个点之间移动摄像机。我们还使用等待时间来在到达路径末尾时停顿一段时间。您可以根据需要调整速度和等待时间,并添加更多点以创建更复杂的路径

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值