简体   繁体   English

谁能知道我出了什么问题,因为我是统一错误 CS0165 的新手:使用未分配的局部变量 'diff'

[英]can anyone what I'm going wrong as I'm new in unity error CS0165: Use of unassigned local variable 'diff'

enter image description here error CS0165: Use of unassigned local variable 'diff'在此处输入图像描述错误 CS0165:使用未分配的局部变量 'diff'

enter image description here在此处输入图像描述

1 : htstrong texttps://i.stack.imgur.com/bML6I.png 1 :htstrong texttps://i.stack.imgur.com/bML6I.png

I believe this must be happening because you need a specific condition to set the diff variable.我相信这一定会发生,因为您需要一个特定的条件来设置 diff 变量。 If that condition is not met, you're not setting it at all.如果不满足该条件,则根本没有设置它。

To fix try setting the diff variable to some value in the else statement on line 27.要修复尝试在第 27 行的 else 语句中将 diff 变量设置为某个值。

Let me know if that works for you.让我知道这是否适合你。

Vlad弗拉德

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复错误CS0165:“使用未分配的局部变量'a'”? - How do I fix Error CS0165: “Use of unassigned local variable 'a'”? 错误 CS0165:使用未分配的局部变量“sot” - error CS0165: Use of unassigned local variable 'sot' 为什么编译器抛出错误CS0165:使用未分配的局部变量? - Why compiler throw error CS0165: Use of unassigned local variable? 如何修复 XmlReader Switch Case 中的“错误 CS0165:使用未分配的局部变量” - How to fix 'error CS0165: Use of unassigned local variable' in XmlReader Switch Case C#错误CS0165:使用未分配的局部变量 - 忽略逻辑和输出引用 - C# error CS0165: Use of unassigned local variable - ignoring logic and out reference 为什么 try/finalize 块不抛出 CS0165:使用未分配的局部变量编译错误? - Why does a try/finalize block does not throw CS0165: Use of unassigned local variable compilation error? 我正在尝试制作计算器,但我不断收到 CS0165,我不知道为什么 - I'm trying to make a calculator but I keep getting CS0165 and I'm confused as to why 我收到一个错误:使用未分配的局部变量“艺术家”,不知道我在做什么错? - I get an error: use of unassigned local variable 'artist', don't know what i'm doing wrong? 对于未分配的局部变量,是否保证CS0165 C#编译器错误? - Is CS0165 C# compiler error guaranteed for unassigned local variables? 货币转换器使用未分配的局部变量错误? 抱歉 - Use of unassigned local variable error for currency converter? I'm Sorry
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM