简体   繁体   中英

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'

And another Assets/spine-unity/Mesh Generation/Arrays/ArraysMeshGenerator.cs(157,19): error CS0165: Use of unassigned local variable `color'

Line 157

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

Line 221

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

Replace line 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

This is assuming you are using an older version of spine-runtimes like v3.4 as your code and line numbers suggest.

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):

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM