小编Neo*_*uro的帖子

Unity 2019.3.0a7:Microsoft Visual C# 编译器错误

我已升级到最新的 Unity 版本 (Unity 2019.3.0a7),但在不同的文件中出现了大量相同的错误。

我与我合作的朋友也运行相同的版本,但没有错误。

有两个,每个引用不同的包,但都引用每个包内的多个错误。

错误大致如下:

(R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.

error CS1504: Source file 'D:\[...]\[UnityProject]\Library\PackageCache\com.unity.test-framework@1.0.16\UnityEngine.TestRunner\NUnitExtensions\Commands\BeforeAfterTestCommandState.cs' could not be opened -- The type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception.
Run Code Online (Sandbox Code Playgroud)

Microsoft (R) Visual C# Compiler version 2.9.1.65535 (9d34608e)
Copyright (C) Microsoft Corporation. All rights reserved.

error CS1504: Source file 'C:\Program Files\Unity\Hub\Editor\2019.3.0a7\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\UIBehaviour.cs' could not be opened -- The type initializer for 'Microsoft.CodeAnalysis.Text.EncodedStringText' threw an exception.
Run Code Online (Sandbox Code Playgroud)

在控制台中的相应错误日志中报告了大约 15-20 个这些错误,但所有关于抛出异常的内容都相同(相同的错误代码)。

我以前从未见过这个错误,我在网上找不到任何帮助。我所有的包裹都是最新的。我不知所措。

我非常感谢有关如何解决此问题的任何建议。

c# compiler-errors unity-game-engine visual-studio

5
推荐指数
2
解决办法
5676
查看次数

结构变量不变

我觉得我错过了一些完全明显的东西,所以我提前道歉(如果?)就是这种情况.我正在尝试做一些非常简单的事情,将结构中的bool值从false更改为true.显然我不能直接更改它,所以我在结构中创建了一个我可以调用的方法,它应该改变那里的值.似乎并非如此.这是代码,我很欣赏任何见解;

public Dictionary<int, List<ScanLineNode>> allScanLineNodes = new Dictionary<int, List<ScanLineNode>>();

public void MethodName(ScanLineNode node [...])
{       
    //This will perform a raycast from the Node's position in the specified direction. If the raycast hits nothing, it will return Vector3.zero ('Row is complete'), otherwise will return the hit point

    Vector3 terminationPoint = node.RaycastDirection(node, direction, maxDist, targetRaycast, replacementColour, backgroundColour);

    ScanLineNode terminationNode = new ScanLineNode();

    //Previously attempted to store a local reference to this row being used, but also did not work
    //List<ScanLineNode> rowNodes = …
Run Code Online (Sandbox Code Playgroud)

c# struct unity-game-engine

1
推荐指数
1
解决办法
55
查看次数

为什么不创建多组随机数?

好的,所以目标是每行/每行生成6个随机数.使用x行数(由用户通过UserInput设置).每行必须有唯一的数字(非重复的数字).我很确定数字是唯一的,但我似乎无法让它有多行,我无法弄清楚我的生活是什么部分阻止了多行.

package rtg;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Random;
import java.util.Set;

public class Array {

public static void main(String[] args) {

    String name;
    int noTickets;
    int[] numbers = new int[6];
    Set<Integer> randomNumbers = new HashSet<>();
    Random rand = new Random();



    int ticketCount = 1;



    System.out.println("Please input your name");
    name = UserInput.readString();
    System.out.println("Please input the number of tickets you want");
    noTickets = UserInput.readInt();
    System.out.println("___________________________________________\n___________________________________________");
    System.out.println("___________________________________________\n___________________________________________");


    System.out.println("Name: " +name+ "\nNumber of Tickets: " +noTickets+ "\nNumbers: ");

    for (ticketCount = 1; ticketCount <= …
Run Code Online (Sandbox Code Playgroud)

java

0
推荐指数
1
解决办法
640
查看次数