内容简介:翻译自:https://stackoverflow.com/questions/32680348/unity3d-slider-onvaluechanged-sending-only-0-or-other-defined-value
我正在尝试将onValueChanged事件附加到我的GUI Slider,但由于某种原因,它给了我一个强制选项来放入一个值(它是“On Value Change(Single)”部分中的第四个框).然后它只发送前面提到的值,而不是滑块的实际值.
该活动的代码如下:
public void ChangeWindDirection(float value) { Debug.Log("New wind direction: " + value); }
我尝试重启Unity和Visual Studio 2013无济于事.现在它甚至会为我尝试创建的每个新事件添加一个值.
public void ChangeWindDirection(Slider slider) { Debug.Log("New wind direction: " + slider.value); }
然后分配滑块:
这样你就可以得到滑块值,或滑块有的其他东西:-)
希望这就是你想要的:-)
翻译自:https://stackoverflow.com/questions/32680348/unity3d-slider-onvaluechanged-sending-only-0-or-other-defined-value
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Android 中如何发送自定义广播
- SpringBoot系列(十四)集成邮件发送服务及邮件发送的几种方式
- Linux如何用脚本监控Oracle发送警告日志ORA-报错发送邮件
- Android 快速发送邮件
- Python 发送邮件
- Python邮件发送指南
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Hit Refresh
Satya Nadella、Greg Shaw / HarperBusiness / 2017-9-26 / USD 20.37
Hit Refresh is about individual change, about the transformation happening inside of Microsoft and the technology that will soon impact all of our lives—the arrival of the most exciting and disruptive......一起来看看 《Hit Refresh》 这本书的介绍吧!