unity中 鼠标按下移动端与pc端的位置

if (Input.GetMouseButtonDown(0))

{

Vector2 V = Input.touchCount > 0 ? Input.GetTouch(0).position : new Vector2(Input.mousePosition.x, Input.mousePosition.y);

}

射线检测

if (Input.GetMouseButtonDown(0))

{

ray = Input.touchCount > 0 ? Camera.main.ScreenPointToRay(Input.GetTouch(0).position) : Camera.main.ScreenPointToRay(Input.mousePosition);

}

相关推荐
霜绛1 小时前
Unity:lua热更新(三)——Lua语法(续)
unity·游戏引擎·lua
世洋Blog9 小时前
更好的利用ChatGPT进行项目的开发
人工智能·unity·chatgpt
evolution_language18 小时前
Unity场景(Scene)的注意事项和易错点
unity·游戏引擎·scene
EQ-雪梨蛋花汤21 小时前
【AI工具】使用 Doubao-Seed-Code 优化 Unity 编辑器插件:从功能实现到界面美化的完整实践
人工智能·unity·编辑器
g***B7381 天前
元宇宙游戏引擎
游戏引擎
Dr.勿忘1 天前
开源Unity小框架:高效单例与模块化设计
游戏·unity·开源·c#·游戏引擎·游戏程序·gamejam
jtymyxmz2 天前
《Unity Shader》8.4 透明度混合
unity·游戏引擎
世洋Blog3 天前
利用<<左移运算符优雅的设计游戏能力的任意组合和判断
游戏·unity·c#
毛甘木3 天前
Unity MonoPInvokeCallback 使用教程
c++·unity
心疼你的一切3 天前
Unity开发Rokid应用之离线语音指令交互模型
android·开发语言·unity·游戏引擎·交互·lucene