Unity3D Slider onValueChanged只发送0(或其他定义的值)

栏目: 后端 · 发布时间: 5年前

内容简介:翻译自:https://stackoverflow.com/questions/32680348/unity3d-slider-onvaluechanged-sending-only-0-or-other-defined-value

我正在尝试将onValueChanged事件附加到我的GUI Slider,但由于某种原因,它给了我一个强制选项来放入一个值(它是“On Value Change(Single)”部分中的第四个框).然后它只发送前面提到的值,而不是滑块的实际值.

Unity3D Slider onValueChanged只发送0(或其他定义的值)

该活动的代码如下:

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);
}

然后分配滑块:

Unity3D Slider onValueChanged只发送0(或其他定义的值)

这样你就可以得到滑块值,或滑块有的其他东西:-)

希望这就是你想要的:-)

翻译自:https://stackoverflow.com/questions/32680348/unity3d-slider-onvaluechanged-sending-only-0-or-other-defined-value


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Hit Refresh

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》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具