Unity2018升级 + VS2019遇到的问题记录

The reference assemblies for framework ".NETFramework,Version=v4.7.1" were not found. To resolve this, install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. Therefore your assembly may not be correctly targeted for the framework you intend.

解决方法:

1Windows -> Search -> Visual Studio Installer -> Modify -> Individual Components and check the right version

2I've fixed it changing to .NET 3.5 in my project (File -> Build Settings -> Player Settings). I had .NET 4.x before.

3Rename the Visual Studio msbuild folder to something else, like:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild ---> MSBuild.old
Warning:
This will most likely break the same feature in Visual Studio... but this is a fix for VS Code.
If someone has a better solution, I'd be interested, but OmniSharp not working is a problem.

4

  1. Close VS Code.
  2. Download and install Microsoft .NET Framework 4.7.1 here: https://www.microsoft.com/en-us/download/details.aspx?id=56119
  3. Restart VS Code.

5To fix the issue 
1. Download and install Microsoft's .NET Framework SDK any version with start 4.X from https://www.microsoft.com/net/download/visual-studio-sdks
2. In VS Code, open 'Assembly_CSharp.csproj' file and change 'TargetFrameworkVersion' to what you installed .NET Framework SDK version

6

I downloaded the Developer pack for 4.7.1 from here: https://www.microsoft.com/en-us/download/confirmation.aspx?id=56119

The pack installed these programs on the target machine (my build server).

  • Microsoft .NET Framework 4.7.1 SDK
  • Microsoft .NET Framework 4.7.1 Targeting Pack
  • Microsoft .NET Framework 4.7.1 Targeting Pack (ENU)

https://dotnet.microsoft.com/download/visual-studio-sdks

.

 

Net4.6更改:

4.0之前 String.Format("Name = {0}, hours = {1:hh}", name, DateTime.Now);

Unity .NET4.xEquivalent  $"Name = { name }, hours = { DateTime.Now:hh}"

var apples = 4;

var bananas = 3;

// Before C# 6.0

Console.WriteLine(String.Format("I have {0} apples", apples));

Console.WriteLine(String.Format("I have {0} fruit", apples + bananas));

// C# 6.0

Console.WriteLine($"I have {apples} apples");

Console.WriteLine($"I have {apples + bananas} fruit");

 

unity2018.2.20里:c#写了不安全代码需要下边操作:

File--BuildSetting--Player Settings--OtherSetting--Allow'unsafe'Code            之前版本操作add a file "smcs.rsp" (or "gmcs.rsp") in your "Assets" directory, which contains the line  -unsafe         the MonoDevelop: go to the solution files tree -> Solution -> your expand your solution -> Assempely-CSharp -> Right Click -> options -> Build -> General -> Language options -> enable "Allow 'unsafe' code"
 

Particle System

 

EditorGUI.EnumMaskField

替换成:

EditorGUI.EnumFlagsField

 

 

Source file '工程目录\Packages\com.unity.textmeshpro\Scripts\Runtime\FastAction.cs' could not be found.

解决办法:

For me it worked to remove the preinstalled Package TextmeshPro. In Unity go to "Window" --> Package Manager --> under Packages: remove TextmeshPro

 

 

Sourcefile'工程目录\Packages\com.unity.package-manager-ui\Editor\Sources\Services\Common\Resources.cs' could not be found.

 

 

 

Unity3d 错误提示 GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced

程序出現這個問題的話,程序編譯時正確,運行時報錯,而且沒有報出是哪個代碼文件出處。

這個問題一般首先去檢查Level內有用到OnGUI,Debug結果發現某代碼文件在調試代碼時複製多了一行GUILayout.BeginArea,去除這行代碼後運行正常!

 

 

 

Assets/T4M/Editor/T4MSC.cs(227,2): error CS0619: `UnityEngine.ProceduralMaterial' is obsolete: `Built-in support for Substance Designer materials has been removed from Unity. To continue using Substance Designer materials, you will need to install Allegorithmic's external importer from the Asset Store.'

解决办法:

 

 

`UnityEngine.Animator.Stop()' is obsolete: `Stop is obsolete. Use Animator.enabled = false instead'

 

ParticleScaler.cs(108,12): error CS1061: Type `UnityEngine.ParticleEmitter' does not contain a definition for `minSize' and no extension method `minSize' of type `UnityEngine.ParticleEmitter' could be found. Are you missing an assembly reference?

 

ParticleScaler.cs(125,13): error CS1061: Type `UnityEngine.ParticleAnimator' does not contain a definition for `force' and no extension method `force' of type `UnityEngine.ParticleAnimator' could be found. Are you missing an assembly reference?

 

 

Source file:

工程目录\Packages\com.unity.package-manager-ui\Editor\Sources\Services\Common\Resources.cs' could not be found.

 

Packages\com.unity.textmeshpro\Scripts\Runtime\TMP_ScrollbarEventHandler.cs' could not be found.

解决方法:

 I also figured out how to pull the text mesh pro 1.3.0 package in without trashing my old guids. if anyone is curious -
 

  1. install text mesh pro package via package manager
  2. delete all the stuff in your old Text Mesh Pro folder
  3. Window > Text Mesh Pro > Install Essential assets (forget what it's called)
  4. find the TextMesh pro package in Library/PackageCache
  5. move all the folders from the Library/PackageCache/textmeshpro... to your Assets/TextMesh Pro folder
  6. mark all the files in the Assets/TextMeshPro folder as Read+Write so you can edit them.
  7. delete the package from Library/PackageCache/
  8. remove the entry for text mesh pro from the manifest.json

now open up unity
 

  1. run the guid remapper that comes with TextMesh pro.
  2. everything should now work, and you can edit the TextMesh Pro source code.

 

 

Source file:

工程目录\Packages\com.unity.standardevents\Editor\Importer.cs' could not be found.

Metadata file:

工程目录\Temp\UnityVS_bin\Debug\UnityEditor.StandardEvents.dll' could not be found

 

Source file '工程目录\Packages\com.unity.textmeshpro\Scripts\Runtime\TMP_DefaultControls.cs' could not be found.

解决方法:

C:\Users\用户名啊\AppData\Local\Unity\cache\packages\packages.unity.com\com.unity.textmeshpro@1.2.4\Scripts Copy到 工程同级Packages\com.unity.textmeshpro\Scripts 里 即可。

Unity2018.2和Unity2018.3以上还不一样?

//PrefabUtility.SaveAsPrefabAssetAndConnect(treeObj, localPath, InteractionMode.AutomatedAction);

                PrefabUtility.CreatePrefab(localPath, treeObj, ReplacePrefabOptions.ConnectToPrefab);

 

PrefabUtility.GetPrefabAssetType(selectedPrefab) == PrefabAssetType.Regular

PrefabUtility.GetPrefabType(selectedPrefab) == PrefabType.Prefab

 

GameObject prefabObj = PrefabUtility.GetCorrespondingObjectFromSource(selectedGameObj);

GameObject prefabObj = (GameObject)PrefabUtility.GetCorrespondingObjectFromSource(selectedGameObj);

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值