当前位置:   article > 正文

Unity Bug合集_webgl.wasm.code.unityweb.wasm.br

webgl.wasm.code.unityweb.wasm.br

错误: error CS0683: UniRx.ReactiveCollection<T>.IReactiveCollection<T>.get_Item(int)' explicit method implementation cannot implementUniRx.IReactiveCollection<T>.this[int].get' because it is an accessor

  1. interface IExample
  2. {
  3. int Test { get; }
  4. }
  5. class CExample : IExample
  6. {
  7. //原
  8. int IExample.get_Test() { return 0; } // CS0683
  9. //修改后
  10. int IExample.Test { get{ return 0; } } // correct
  11. }
  1. //原
  2. T IReactiveCollection<T>.get_Item(int index)
  3. {
  4. return base[index];
  5. }
  6. void IReactiveCollection<T>.set_Item(int index, T value)
  7. {
  8. base[index] = value;
  9. }
  10. T IReadOnlyReactiveCollection<T>.get_Item(int index)
  11. {
  12. return base[index];
  13. }
  14. //修改后
  15. public new T this[int index]
  16. {
  17. get
  18. {
  19. return base[index];
  20. }
  21. set
  22. {
  23. base[index] = value;
  24. }
  25. }

错误:CS433:类型“MonoBehaviour同时存在于UnityEngineCoreModuleVersion0.0.0.0.Cultureneutral PublicKeyTokennull和“UnityEngineVersion0.0.0.0,CultureneutralPublicKeyTokennull中

删掉UnityEngine.dll

UNITY某个新版本后,把UnityEngine.dll的东西全部拆解到其它DLL了,主要核心功能在UnityEngine.coreModule.dll中,其它功能比如UnityEngine.Coremodule等。 而UnityEngine.dll完全是一个空壳,打开看里面全是空类,空代码。

错误:Unity打包WebGL在网页运行出现“To use diopen,you need yo use Emscript's linking support”问题解决方法。

解决方案

**错误:** $LOAD_DATA_FROM_SUBPACKAGE is not defined

1.检查打包的路径是否有中文,如果有中文,则可能会导致minigame/wasmcode/.webgl.wasm.code.unityweb.wasm.br代码分包文件无法生成

2.在转换小游戏时,要确保代码分包和资源首包的加起来的文件大小不能超过20M

错误:An error occurred while resolving packages: Project has invalid dependencies: com.unity.package-manager-ui: Package [com.unity.package-manager-ui@2.1.2] cannot be found Package com.unity.textmeshpro@2.0.0 has invalid dependencies: com.unity.ugui: Package [com.unity.ugui@1.0.0] cannot be found

把工程目录下的Packages目录中的manifest.json删掉, 然后再自动生成

错误:error CS0433: The imported type System.Xml.XmlNode is defined multiple times

方法一:将Plugins文件夹中System.Xml.dll移除

方法二:File - Build Setting - Player Setting - Other Settings - Scripting Runtime Version - 改为.Net 4.x

错误:Errors during import of AudioClip Assets/Resources/sounds/effects/Battle_TroopB_Shoot3.wav: FSBTool ERROR: The format of the source file is invalid, see output for details. FSBTool ERROR: Internal error from FMOD sub-system.
 

  • 方法一:检查音频文件的采样率:Unity可能无法处理某些特定的采样率。尝试将音频文件的采样率更改为44100Hz或48000Hz。

  • 方法二:重新导入音频文件:右键 - ReImport

错误:Compile error CS0079 : The event 'CustomEvent' can only appear on the left hand side of += or -=

  1. //原
  2. private Action<AndroidImagePickResult> m_OnImagePicked;
  3. public event Action<AndroidImagePickResult> OnImagePicked
  4. {
  5. add
  6. {
  7. Action<AndroidImagePickResult> action = this.m_OnImagePicked;
  8. Action<AndroidImagePickResult> action2;
  9. do
  10. {
  11. action2 = action;
  12. action = Interlocked.CompareExchange(ref this.m_OnImagePicked, (Action<AndroidImagePickResult>)Delegate.Combine(action2, value), action);
  13. }
  14. while (action != action2);
  15. }
  16. remove
  17. {
  18. Action<AndroidImagePickResult> action = this.m_OnImagePicked;
  19. Action<AndroidImagePickResult> action2;
  20. do
  21. {
  22. action2 = action;
  23. action = Interlocked.CompareExchange(ref this.m_OnImagePicked, (Action<AndroidImagePickResult>)Delegate.Remove(action2, value), action);
  24. }
  25. while (action != action2);
  26. }
  27. }
  28. public AndroidCamera()
  29. {
  30. this.OnImagePicked = delegate
  31. {
  32. };
  33. base._002Ector();
  34. }
  35. //修复后
  36. public event Action<AndroidImagePickResult> OnImagePicked;
  37. public AndroidCamera()
  38. {
  39. this.OnImagePicked = delegate
  40. {
  41. };
  42. }

错误: error CS0619: ' xxxxxx ' is obsolete: ' xxxxx export is no longer supported .'

//原                                                                //改
RuntimePlatform.OSXWebPlayer                RuntimePlatform.OSXPlayer
RuntimePlatform.WindowsWebPlayer         RuntimePlatform.WindowsPlayer

//原
gameObject.transform.position = new Vector3(0f, 1f);
guiText.anchor = TextAnchor.UpperLeft;
guiText.alignment = TextAlignment.Left;
guiText.pixelOffset = pixelOffset;

//改
textComponent.rectTransform.localPosition = new Vector3(0f, 1f);
textComponent.alignment = TextAnchor.UpperLeft;
textComponent.alignment = TextAlignment.Left;
textComponent.rectTransform.anchoredPosition = pixelOffset;

RuntimePlatform.OSXDashboardPlayer //停止使用

错误ssembly ‘XXX.DLL’ will not be loaded due to errors: XXX references strong named ICSharpCode.SharpZipLib Assembly references: 0.85.5.452 Found in project: 0.86.0.518.Assembly Version Validation can be disabled in Player Settings “Assembly Version Validation”

Edit - Project Settings - Player - Other Settings - Assembly Version Validation

错误:error CS0636: The FieldOffset attribute can only be placed on members of types marked with the StructLayout(LayoutKind.Explicit)

//原
 [StructLayout(2)]
  private struct DoubleLongBytesUnion
  {
      [FieldOffset(0)]
      public double d;
  }

//改
 [StructLayout(LayoutKind.Explicit)]
  private struct DoubleLongBytesUnion
  {
      [FieldOffset(0)]
      public double d;
  }

错误:cannot explicitly call operator or accessor

this.get_myKick 改成 ()=>myKick

错误:提示参数shader为空

Edit - Project Settings - Graphics ; 将需要用到的shader拖拽进来

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/92716
推荐阅读
相关标签
  

闽ICP备14008679号