内容简介:翻译自: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
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Learn Python the Hard Way
Zed Shaw / Example Product Manufacturer / 2011
This is a very beginner book for people who want to learn to code. If you can already code then the book will probably drive you insane. It's intended for people who have no coding chops to build up t......一起来看看 《Learn Python the Hard Way》 这本书的介绍吧!