是否可以从脚本中选择并移动屏幕上的操纵杆?
我尝试通过触摸以编程方式添加操纵杆。带有连接的屏幕棒游戏对象的预制将进行实例化,如果我释放此手指,则游戏对象将被销毁。唯一的问题是,我无法移动操纵杆。有没有办法让操纵杆对实例化操纵杆预制的手指负责?
我尝试了这一点:但是没有运气:
ExecuteEvents.Execute(leftJoyStick.GetComponent<OnScreenStick>().gameObject,
new BaseEventData(EventSystem.current), ExecuteEvents.selectHandler);
请帮忙。
I try to add a Joystick programmatically by a touch. The prefab with the attached On-Screen Stick gameobject get instantiated and if I release this finger, the gameobject get destroyed. The only problem is, I cannot move the joystick. Is there a way to make the joystick responsible to the finger who instantiated the joystick prefab?
i tried this: but with no luck:
ExecuteEvents.Execute(leftJoyStick.GetComponent<OnScreenStick>().gameObject,
new BaseEventData(EventSystem.current), ExecuteEvents.selectHandler);
please help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我有点愚蠢。我不需要操纵杆,以这种方式吼叫。
当我触摸屏幕的右侧时,我可以环顾四周,当我触摸屏幕的左侧时,我可以在没有静态操纵杆的情况下四处走动。
Ok i'm kinda stupid. i don't need a joystick and do it this way bellow.
when i touch the right side of screen i can look around, when i touch the left side of screen i can move around without a static joystick.