简体   繁体   English

C#/ Unity:未传递Visual Studio参数

[英]C# / Unity : Visual Studio parameter not getting passed

Problem Overview: Parameter passed to function is not making it to the function 问题概述:传递给函数的参数未传递给函数

I have a function call in one script that calls another. 我在一个脚本中调用了另一个脚本。 The caller is shown below- 呼叫者如下所示- 来电显示

However, the function which gets called (and I am sure that it is being called due to stepping directly into the function and only stepping forwards one line at a time), never gets that variable. 但是,被调用的函数(并且我确信它是由于直接进入该函数并且一次仅向前步进一行而被调用),所以永远不会获得该变量。

在此处输入图片说明

Hovering over the name parameter does nothing, even though hovering over the searchAllScenes gives me a value of false. 将鼠标悬停在name参数上没有任何作用,即使将鼠标悬停在searchAllScenes上也可以得到false值。 The name parameter similarly does not show up in Autos, and typing it into the Immediate Window returns "Unable to evaluate the expression. General Exception". 同样, name参数不会显示在Autos中,并且在“立即窗口”中键入该参数将返回“无法评估表达式。常规异常”。 It's also not being set to the default null value, as lines 265-266 are never triggered. 也不会将其设置为默认的空值,因为从不触发第265-266行。

I feel like this is a compiler issue, and have tried rebuilding the solution, but the same problem keeps occurring, preventing my project from working. 我觉得这是一个编译器问题,并且尝试过重建解决方案,但是相同的问题不断发生,导致我的项目无法正常工作。 It was working a few days ago, it just stopped, with no changes made (I have git reverted back to previous versions and they do not work). 几天前它在工作,只是停止了,没有做任何更改(我已经将git恢复到以前的版本,并且它们不起作用)。

Versions: 版本:

  • Visual Studio Community 2017, Version 15.8.9 Visual Studio Community 2017版本15.8.9
  • Unity 2018.2.14f1 Personal Unity 2018.2.14f1个人

Nothing ended up working. 什么都没有结束。 I tried deleting the obj and bin folders and rebuilding, but it still did not work. 我尝试删除obj和bin文件夹并重建,但是仍然无法正常工作。 However, for some reason, simply deleting the objects that were using those scripts and reimporting them made everything work again. 但是,由于某些原因,只需删除使用这些脚本的对象并重新导入它们,即可使所有功能再次正常工作。

This isn't exactly a fix, as I still don't understand what happened, though. 不过,这并不是一个解决办法,因为我仍然不了解发生了什么。

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

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