Is there any way in Unity of defining resources for a particular platform that should be ignored by Unity when on another build platform?
I like to use LINQ, but when my target is the Web Player I get the error message:
error CS0234: The type or namespace name `Linq' does not exist in the namespace `System.Xml'. Are you missing an assembly reference?
I can solve this by copying the System.Xml.Linq.dll to my Plugins folder, and now Unity knows about LINQ.
Then when I switch target to Android I get the error message:
error CS0433: The imported type `System.Xml.Linq.XDocument' is defined multiple times
Which is resolved by deleting System.Xml.Linq.dll from the Plugins folder.
I'd like Unity to ignore System.Xml.Linq.dll when on Android and notice it when on Web Player target.
A solution for getting Unity to see LINQ when on Web Player platform without copying the DLL into the project, would also be fine.
Thanks in advance
there is this in the unity docs:
http://docs.unity3d.com/Manual/PlatformDependentCompilation.html
Related
I'm trying to update a Unity project that was built in version 2019.4.01f (Intel, LTS) to version 2021.3.10f (Apple Silicon, LTS). The reason is that I need update the In App Purchases package from Unity because Google Play requires that I update the billing library.
I already tried a bunch of options, but I keep getting errors. If I generate the GoogleTangle I get error CS0103: The name 'Obfuscator' does not exist in the current context. If I don't generate new tangles or copy the old tangles from the old path to the new one (according to the steps from here), I get other errors like: error CS0234: The type or namespace name 'Purchasing' does not exist in the namespace 'UnityEngine' (are you missing an assembly reference?) and other similar errors. If I manually add some of the Purchasing assembly definitions I see no improvements.
Did anyone tried doing this recently?
The reason for the error was an Assembly definition. In order to allow PlayMode tests access to some of the game code I had an Assembly Definition in Assets/Scripts that was referenced in the PlayMode Assembly.
After removing the tests and the Assembly definition, the errors went away except for a new one that lets you know that you need to initialise Unity Services before initialising Purchasing (that's how Unity Purchasing works now).
This was a quick fix. The correct solution would be to keep the tests and use Assembly definitions in the folders that contain the code that PlayMode tests need to access. That will most probably lead to the need of Assembly definitions in other folders as well and at this point the code structure must be built in such a way that you don't get cyclic references between Assembly definitions.
I was following this tutorial https://www.youtube.com/watch?v=8VVgIjWBXks
about making a multiplayer game in unity using Mirror https://assetstore.unity.com/packages/tools/network/mirror-129321.
So obviously I went to the asset store and imported it... (I'm using unity 2020.1)
But now it's throwing a ton of errors and not letting me use "using Mirror;"
VSCode says: The type or namespace name 'Mirror' could not be found (are you missing a using directive or an assembly reference?) [Assembly-CSharp]
Interestingly enough I can run the game without any issues even with all the errors but when I try in my code to "using Mirror;" it doesn't work
I tried reimporting and restarting the project, regenerating .csproj files, and even trying on different unity versions but nothing worked. I'm assuming that the Mirror package itself is totally fine but I'm doing something stupid....
Any idea what I could do?
This seems to be the problem:
Most likely the version of VS Code you have installed, reverting VS Code C# Extension from 1.23 to 1.22.
The short term fix involves literally deleting Mirror from Unity and re-importing it from the Package Manager. Also deleting *.vscode and *.SLN files.
A proper discussion about this issue is found at Omnisharp-vscode GitHub page.
I had to ensure player settings had scripting define symbols:
MIRROR
MIRROR_17_0_OR_NEWER
I'm using Unity3d 5.6.0f3 and develop a game which uses the Xbox Live Creators Plugin and the Mixer-Interactive-Plugin.
My problem is that both uses the Newtonsoft.Json.dll in different versions, so I got the error message:
error CS1703: An assembly 'Newtonsoft.Json' with the same identity has
already been imported. Consider removing one of the references
Assets/Xbox Live/Libs/Unity/Newtonsoft.Json.dll (Location of the
symbol related to previous error)
Assets/MixerInteractive/Source/DLLs/Win32/Newtonsoft.Json.dll
(Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
Removing one of these assemblies gives an DirectoryNotFoundException in addition, but the previous mentioned error message still exists.
Is there any way to manage references or does anyone know how to fix this?
It was too easy ...
Because the Mixer Interactive Plugin is open source and no pre-compiled assembly with static dependencies, it was possible to just untick all Newtonsoft.Json-references at the import process to unity.
Thank for bringing this up. The quickest way to fix it is to delete Newtonsoft.Json.dll from one of the two plugins. Deleting it from the Xbox Live plugin is simpler (since the plugin has fewer platform checkboxes checked).
We'll see what we can do to make this better.
I'm getting an error CS0246 saying the file 'BaseMeshEffect' could not be found. But the same project in my colleagues computers work fine. Where can I find this file?
Assets/_UI/Packages/Gamestrap UI/Effects/ShadowEffect.cs(11,33): error CS0246: The type or namespace name `BaseMeshEffect' could not be found. Are you missing a using directive or an assembly reference?
Thanks
It sounds like you're using a different version of Unity than your colleagues. Update to Unity 5.2.
Reference
Hey I just found this thread, I'm one of the creator of Gamestrap UI and I saw you were having an issue with it, Unity upgraded it's version and changed a lot of stuff in the effects section, I've already uploaded a new version of the asset so it can work with the 5.2 version and the older versions as well, you just have to redownload the asset and it should work. Hope you are liking Gamestrap!
I am getting this error after importing the facebook sdk on my unity 4.6.1 , anyone can help me with a solution on this?
Assets/Facebook/Scripts/IOSFacebookLoader.cs(6,42): error CS0246: The type or namespace name `FB' could not be found. Are you missing a using directive or an assembly reference?
I am not sure but I think you are missing the line "using Facebook.MiniJSON" at the top of your code.
An error in another script someplace in an existing project could be preventing compilation of the Facebook .cs files, which would make the FB class inaccessible.
Is this in a new Unity project (for testing) or an existing Unity project? Have you tried following the "Get Started with Facebook Unity SDK" tutorial to set up the Interactive Console scene in the Facebook console?