简体   繁体   中英

error when creating an android projects in unity

When creating an android project in unity there is always these 3 errors that doesn't make it compile without even adding anything.

  1. C:\\ProgramFiles\\Unity\\Hub\\Editor\\2019.2.0f1\\Editor\\Data\\Resources\\PackageManager\\BuiltInPackages\\com.unity.ugui\\Runtime\\EventSystem\\InputModules\\BaseInput.cs(19,24): error CS0246: The type or namespace name 'IMECompositionMode' could not be found (are you missing a using directive or an assembly reference?)

  2. C:\\ProgramFiles\\Unity\\Hub\\Editor\\2019.2.0f1\\Editor\\Data\\Resources\\PackageManager\\BuiltInPackages\\com.unity.ugui\\Runtime\\EventSystem\\InputModules\\BaseInput.cs(104,24): error CS0246: The type or namespace name 'Touch' could not be found (are you missing a using directive or an assembly reference?)

  3. C:\\ProgramFiles\\Unity\\Hub\\Editor\\2019.2.0f1\\Editor\\Data\\Resources\\PackageManager\\BuiltInPackages\\com.unity.ugui\\Runtime\\EventSystem\\InputModules\\PointerInputModule.cs(70,61): error CS0246: The type or namespace name 'Touch' could not be found (are you missing a using directive or an assembly reference?)

This seems to be the same error as in this post: https://forum.unity.com/threads/i-have-a-problem-getting-start-in-webgl.736436/

This was for a WebGL build but if you follow the link in the sixth post (changing the version number) there's a download for Android as well.

In my case I has installed WebGL Target Support for Unity 2019.1.1 (which I used for an older project), but my current project was on 2019.2.1. So go to https://unity3d.com/unity/whats-new/2019.2.1 (replace the last part of the url with whichever Unity version you're using) and scroll down to WebGL Target Support and download+install it (choose the correct Unity path in installation). That should fix the problem.

It's possible that the Package Manager from Unity (by some reason) is missing those files, and therefore cannot find them.

You could try:

  • Reset the packages to default values (go to Help -> Reset Package to Defaults )

  • Another thing that you could check, but only if you are using Assembly Definitions (.asmdef files), in this case, you should check if the dependencies are set correctly.

Did you install the android build support module on your current unity version ? I had the same errors once and I realised this was the reason...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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