Keywords: Unity, Solution for common issues

failed to open source file: ‘Packages/com.unity.render-pipelines.xxx’

Error at compiling assets:

Shader error in 'XXX': failed to open source file: 'Packages/com.unity.render-pipelines.lightweight/ShaderLibrary/Core.hlsl' at line 72 (on d3d11)

Reason:
Render pipelines were missed in project, e.g. you created a project using 3D template.

Solution:
Create a project using LWRP template or High Definition RP template, these two templates provided new render pipelines.

Reference:
[LWRP] UPGRADING LWRP PACKAGE TO 7.0.0 BREAKS FORWARDRENDERDATA ASSET IN RESOURCE FILES
https://issuetracker.unity3d.com/issues/lwrp-upgrading-lwrp-package-to-7-dot-0-0-breaks-forwardrenderdata-asset-in-resource-files

Assets go pink

Issue:
Assets in scene go pink (purple).

Reason:
1, Materias and shaders of assets were missed.
2, Materias and shaders of assets using old render pipeline which not support in new verson.

Solution:
Retarget materias and shaders in meshes or update materials and shaders.

Reference:
everything became pink
https://answers.unity.com/questions/168624/everything-became-pink.html

Error CS0246: The type or namespace name ‘float2’ could not be found

Error at building project

error CS0246: The type or namespace name 'float2' could not be found (are you missing a using directive or an assembly reference?)

Caused by:
Missing requisite package.

Solution:
Install Mathematics: Windows -> Package Manager -> Select Mathematics and click Install.

An assembly with the same simple name ‘SyntaxTree.VisualStudio.Unity.Bridge’ has already been importe

Error log in editor console:

error CS1704: An assembly with the same simple name 'SyntaxTree.VisualStudio.Unity.Bridge' has already been imported. Try removing one of the references (e.g. 'D:\Program_Filesx86\Microsoft Visual Studio Tools for Unity\16.0\Editor\SyntaxTree.VisualStudio.Unity.Bridge.dll') or sign them to enable side-by-side.

Error log on compiling project in Visual Studio:

error CS0234: The type or namespace name 'UI' does not exist in the namespace 'UnityEngine'

Solution:

  1. Close Editor and Visual Studio.
  2. Remove file C:\Program Files(x86)\Microsoft Visual Studio Tools for Unity\16.0\Editor\SyntaxTree.VisualStudio.Unity.Bridge.dll.
  3. Remove files .sln and .csproj and remove directories Library and obj.
  4. Reimport project and open Editor and Visual Studio.

It is not a lack of love, but a lack of friendship that makes unhappy marriages. ― Friedrich Nietzsche, Twilight of the Idols