【发布时间】:2020-10-06 06:28:20
【问题描述】:
我对 Unity 还很陌生,所以请原谅我如果我没有给你足够的信息,但是每当我在 Unity 中打开项目时都会遇到一些错误。
前两个是:Unity Error Image
#1:
***Library\PackageCach\.com.unity.postprocessing@2.0.3-preview\PostProccessing\Runtime\PostProcessManager.cs(424,66):error CS0117:'EditorSceneManager' does not contain a definition for 'IsGameObjectInScene'\***
#2:***Library\PackageCach\.com.unity.postprocessing@2.0.3-preview\PostProccessing\Runtime\PostProcessManager.cs(425,66):error CS0117:'EditorSceneManager' does not contain a definition for 'IsGameObjectInMainScene'***
如果我进入代码并删除这两行
? UnityEditor.SceneManagement.EditorSceneManager.IsGameObjectInScene(volume.gameObject, customScene)
: UnityEditor.SceneManagement.EditorSceneManager.IsGameObjectInMainScenes(volume.gameObject);
从这里
#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR
// If the current camera have a custom scene then the camera is rendering that scene,
// otherwise the camera is rendering the scenes in the SceneManager.
var customScene = camera.scene;
return customScene.IsValid()
? UnityEditor.SceneManagement.EditorSceneManager.IsGameObjectInScene(volume.gameObject, customScene)
: UnityEditor.SceneManagement.EditorSceneManager.IsGameObjectInMainScenes(volume.gameObject);
#else
return true;
它在 Unity 中给了我一个语法错误: ;预计
当我修复这个错误时,它给了我这个错误:
**Library\PackageCache\com.unity.postprocessing@2.0.3-preview\PostProcessing\Editor\Utils\PostProcessShaderIncludePath.cs(10,10): error CS0619: 'ShaderIncludePathAttribute' is obsolete: '[ShaderIncludePath] attribute is no longer supported. Your shader library must be under the Assets folder or in a package. To include shader headers directly from a package, use #include "Packages/<package name>/<path to your header file>"'**
我删除这行代码后:
[ShaderIncludePath]
从这里:
#if UNITY_2018_1_OR_NEWER
[ShaderIncludePath]
#endif
public static string[] GetPaths()
{
var srpMarker = Directory.GetFiles(Application.dataPath, "POSTFXMARKER", SearchOption.AllDirectories).FirstOrDefault();
var paths = new string[srpMarker == null ? 1 : 2];
var index = 0;
if (srpMarker != null)
{
paths[index] = Directory.GetParent(srpMarker).ToString();
index++;
}
paths[index] = Path.GetFullPath("Packages/com.unity.postprocessing");
return paths;
修复所有问题后,我可以正常使用 Unity。如果这对导出我的项目没有未来影响,我可以每次都删除它。但我对任何代码的作用一无所知,所以如果有人可以帮助我或知道如何解决它,请告诉我。
【问题讨论】: