简体   繁体   English

错误CS0165:使用未分配的局部变量“颜色”

[英]error CS0165: Use of unassigned local variable `color'

I got this error when compiling a unity game. 编译统一游戏时出现此错误。 How to fix this ? 如何解决呢?

Thanks 谢谢

Assets/spine-unity/Mesh Generation/Arrays/ArraysMeshGenerator.cs(221,21): error CS0165: Use of unassigned local variable `color' 资产/ spine-unity /网格生成/数组/ArraysMeshGenerator.cs(221,21):错误CS0165:使用未分配的局部变量“颜色”

And another Assets/spine-unity/Mesh Generation/Arrays/ArraysMeshGenerator.cs(157,19): error CS0165: Use of unassigned local variable `color' 还有另一个Assets / spine-unity / Mesh Generation / Arrays / ArraysMeshGenerator.cs(157,19):错误CS0165:使用未分配的局部变量“颜色”

Line 157 157行

colors[vi] = color; colors[vi + 1] = color; colors[vi + 2] = color; colors[vi + 3] = color;

Line 221 221行

colors[vi] = color; uvs[vi].x = attachmentUVs[iii]; uvs[vi].y = attachmentUVs[iii + 1];

Replace line 116 更换第116行

Color32 color;

with

Color32 color = default(Color);

Source code (which has the problem): 源代码(有问题):

https://github.com/EsotericSoftware/spine-runtimes/blob/3.4.02/spine-unity/Assets/spine-unity/Mesh%20Generation/Arrays/ArraysMeshGenerator.cs https://github.com/EsotericSoftware/spine-runtimes/blob/3.4.02/spine-unity/Assets/spine-unity/Mesh%20Generation/Arrays/ArraysMeshGenerator.cs

This is assuming you are using an older version of spine-runtimes like v3.4 as your code and line numbers suggest. 这是假设您使用的是较旧版本的spine运行时,例如v3.4,如代码和行号所示。

If you upgrade to the latest Spine Unity runtime (for instance version 3.6.39), you will also have this problem, but in a different file (SpineMesh.cs): 如果升级到最新的Spine Unity运行时(例如版本3.6.39),您也会遇到此问题,但是在另一个文件(SpineMesh.cs)中:

https://github.com/EsotericSoftware/spine-runtimes/blob/3.6.39/spine-unity/Assets/spine-unity/Mesh%20Generation/SpineMesh.cs https://github.com/EsotericSoftware/spine-runtimes/blob/3.6.39/spine-unity/Assets/spine-unity/Mesh%20Generation/SpineMesh.cs

In this case, apply the same fix to lines 460 and 664. 在这种情况下,将相同的修补程序应用于行460和664。

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

相关问题 错误 CS0165:使用未分配的局部变量“sot” - error CS0165: Use of unassigned local variable 'sot' 谁能知道我出了什么问题,因为我是统一错误 CS0165 的新手:使用未分配的局部变量 'diff' - can anyone what I'm going wrong as I'm new in unity error CS0165: Use of unassigned local variable 'diff' C# 脚本 unity 2d 创建克隆错误 CS0165 - C# script unity 2d creating a clone Error CS0165 在Unity中使用未分配的局部变量 - Use of unassigned local variable in Unity 使用未分配的局部变量“随机” - Use of unassigned local variable 'Random' 错误:“使用未分配的局部变量‘BoxPrefab’”。 我该如何解决? - Error: "Use of unassigned local variable 'BoxPrefab'". How do I fix this? C#-使用未分配的局部变量 - C# - Use of unassigned local variable 尝试从另一个脚本获取变量时使用未分配的局部变量 - Use of unassigned local variable when trying to get variable from another script Unity脚本缺少变量和未分配的局部变量C#的定义 - Unity Scripting missing definition for a variable and a unassigned local variable c# Assets\\FPS\\Audio\\Soundtrack\\MusicManager.cs(35,70):错误 CS0841:在声明之前不能使用局部变量“currentScene” - Assets\FPS\Audio\Soundtrack\MusicManager.cs(35,70): error CS0841: Cannot use local variable 'currentScene' before it is declared
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM