Unity + Moonsharp : iOS release version > Not work - c#

We are using Moonsharp (Lua Interpreter) con our Unity new Game (Unity v.5.4.1)
On Android works well. And... thats de key...
However in iOS in the DEV version there are no problems, but in the RELEASE version it does not run correctly.
We have the following error:
"ScriptRunTimeException: Can not convert clr type System.MonoType"
What kind of differences between ios develop or release version?
I repeat. We only get that error once it is released to the iTunes Store, not in Dev mode.
Any solution?

This is likely a bug.
Change UserData.RegisterAssembly()
to
UserData.RegisterAssembly(typeof(Program).Assembly); or something similar.
Just use the RegisterAssembly overload function with the Assembly parameter. This will likely fix your problem.

Related

How do I avoid assembly converter build error?

Attempting to build a Mixed Reality project I'm getting an (extremely long) error message, the meat of which is:
Error:
The command [...]\UWP\Unity\Tools\AssemblyConverter.exe" -platform=uap -lock=...
exited with code 1.
This is happening in Unity 2017.3.0f (but was happening with the previous version as well) and Visual Studio 17.
Unfortunately we have no leverage on this tool. The following unofficial workaround was published by a user: perhaps you should have a look to see if it can help you until you upgrade to a newer Unity (but it seems that they will only support IL2CPP builds going forward):
https://dotnetbyexample.blogspot.com/2018/05/fixing-unitytoolsassemblyconverterexe.html

When installing Firebase on Unity, I get an error "Unloading broken assembly"

I am planning to introduce Firebase to add a push notification function to the game I made with Unity.
I pasted the application-specific google-services.json in the Asset folder,
I installed FirebaseMessaging.unitypackage of SDK downloaded from here, but I get an error.
Console
Unloading broken assembly Assets/Firebase/Plugins/Firebase.App.dll, this assembly can cause crashes in the runtime
Unloading broken assembly Assets/Firebase/Plugins/Firebase.Messaging.dll, this assembly can cause crashes in the runtime
Unloading broken assembly Assets/Firebase/Plugins/Firebase.Platform.dll, this assembly can cause crashes in the runtime
Generation of the Firebase Android resource file google-services.xml from Assets/google-services.json failed.
If you have not included a valid Firebase Android resources in your app it will fail to initialize.
C:/UnityProjects/Test/Assets..\Assets\Firebase\Editor\generate_xml_from_google_services_json.exe -i "Assets/google-services.json" -l.
Microsoft.VC90.CRT.manifest could not be extracted!
You can start to diagnose this issue by executing "C:/UnityProjects/Test/Assets..\Assets\Firebase\Editor\generate_xml_from_google_services_json.exe -i "Assets/google-services.json" -l." from the command line.
UnityEngine.Debug:LogError(Object)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:RunResourceGenerator(String, String, Boolean) (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:508)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:ReadBundleIds(String) (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:369)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:UpdateConfigFileDirectory() (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:261)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:CheckConfiguration() (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:223)
Firebase.Editor.GenerateXmlFromGoogleServicesJson:.cctor() (at Z:/tmp/tmp.CeTbzghE2x/firebase/app/client/unity/editor/src/GenerateXmlFromGoogleServicesJson.cs:83)
UnityEditor.EditorAssemblies:ProcessInitializeOnLoadAttributes()
I'd like to add this;
public void Start() {
Firebase.Messaging.FirebaseMessaging.TokenReceived += OnTokenReceived;
Firebase.Messaging.FirebaseMessaging.MessageReceived += OnMessageReceived;
}
but due to errors, I get errors on the OnTokenReceived and OnMessageReceived parts.
Do these have problems with google-services.json created with Firebase for applications?
Anyone please solve me.
Check your Project Settings > IOS. Make sure the .NET is 4.X not 3.
https://docs.unity3d.com/Manual/ScriptingRuntimeUpgrade.html
I was facing the same error and find an answer from the Firebase's Github. Here is the post from the Github:
All "Unloading the assembly" does is unload the DLL from the app
domain (i.e Unity's process) then disable the platform targeting
options. So what you'll need to do is select the unloaded DLL(s) and
in the plugin inspector tick the platform check boxes to re-enable
them for the appropriate platform.
We typically follow the pattern to enable target platforms:
Firebase/*.dll : Target Android, Editor, Standalone - with the
exception of FIrebase.Database.dll Firebase/Firebase.Database.dll
: Target Android-only Firebase/iOS/*.dll : Target iOS
Firebase/Mono/Firebase.Database.dll : Target Editor, Standalone
Here is the link: https://github.com/firebase/quickstart-unity/issues/256
Hope it helps.
I ran into this problem with a freshly created project. The project was targeting Android and I was loading the dotnet4 version of the assembly. I switched to the dotnet3 version and it fixed the issue. I noticed that the Script Runtime Version targets .NET 3.5 Equivalent by default. I'm brand new to Unity, so I'm not sure if that's the issue.
Whenever Firebase.Editor.GenerateXMLFromGoogleServicesJson.* is missing, it's because Unity won't load it in, or has been instructed not to. Check this by clicking on Assets/Firebase/Editor/Firebase.Editor and make sure the "Editor" checkbox is on. If you changed it, hit apply, close Unity, reopen it. That may throw some errors as it figures itself out. Close, reopen it and all should be well. Binding and unbinding dll's has some complexity to it, so I always close Unity after messing with assembly dependencies.

How do you compile a managed dll with mono/mcs targeting a specific framework?

I have been using mono/mcs to compile dynamically generated (Protocol Buffer) code into managed DLLs for use in Unity. As of Unity 5.5, it looks like it will no longer load DLLs compiled against the 4.0 framework (I believe it wants 2.0).
I have seen how to do this in MonoDevelop or Visual Studio, but I would like to do this on the command line because the protobuf code is dynamically generated so it makes it much easier to use a shell script to compile.
In the shell script we do something like this:
mono --runtime=v2.0.50727 <stuff>
mcs -langversion:ISO-2 -sdk:2 -r:$unityengine_dll -target:library -out:$output <stuff>
When we do this, we've always had warnings come up in the following form (which makes it look like the target runtime is not actually being set correctly). Even with these warnings, in Unity 5.4.x it would load the dll fine and compile. In Unity 5.5+ it doesn't seem to be able to load the dll and dies on compilation errors (where it doesn't find things which should be defined in the dll)
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
No framework specified; defaulting to 4.0.30319.42000
What do we need to change? I have been playing around with the --runtime, --langversion, and -sdk -lib options of mono/mcs to no avail. What should these be set to for compiling for unity? Have also tried using both a current up-to-date version of mono to compile and also the mono that comes with Unity, both have the same issue.
Enviornment: osx sierra 10.12.3, unity 5.5, mono 4.6.2.16
looks like I just had to point mono and mcs to the versions in /Library/Frameworks/Mono.framework/Versions/3.12.1/ then they picked up the right assemblies to build against!

Undeclared Identifier error Unity IOS to Xcode

I've a Unity 5.3.1 iOS project that also uses the new multiplayer network, UNet. Scary stuff. When I build and run the project, I get the following error in Xcode:
Use of undeclared identifier `IL2CPP_RAISE_MANAGED_EXCEPTION`
The project runs fine in the Unity Editor. It's in a huge Bulk_Generics_10.cpp
script that deals with System.Comparison1<UnityEngine.Networking.NetworkSystem.PeerInfoPlayer
Here is the block of code that the error is found.
// System.Void
System.Linq.Enumerable/<CreateDistinctIterator>c__Iterator3`1<System.Object>::Reset()
extern TypeInfo*
NotSupportedException_t1382227673_0_il2cpp_TypeInfo_var; extern const
uint32_t
U3CCreateDistinctIteratorU3Ec__Iterator3_1_Reset_m_1278777949_0_MetadataUsageId;
extern "C" void
U3CCreateDistinctIteratorU3Ec__Iterator3_1_Reset_m_1278777949_0_gshared
(U3CCreateDistinctIteratorU3Ec__Iterator3_1_t1454147488_0 * __this,
const MethodInfo* method) { static bool s_Il2CppMethodIntialized; if
(!s_Il2CppMethodIntialized) { il2cpp_codegen_initialize_method
(U3CCreateDistinctIteratorU3Ec__Iterator3_1_Reset_m_1278777949_0_MetadataUsageId);
s_Il2CppMethodIntialized = true; } {
NotSupportedException_t1382227673_0 * L_0 =
(NotSupportedException_t1382227673_0 *)il2cpp_codegen_object_new
(NotSupportedException_t1382227673_0_il2cpp_TypeInfo_var);
NotSupportedException__ctor_m149930845_0(L_0, /*hidden
argument*/NULL); IL2CPP_RAISE_MANAGED_EXCEPTION(L_0); } }
Looks like Unity did not hand it off cleanly to Xcode. I'm wondering if there's some adjustment I need to make in Unity.
How can I correct this error?
This is a new problem with the build packages for different platforms being optional in the installer. If you install a platform and then upgrade your version of Unity but don't install that platform on the second install the old version of the platform will remain and cause problems.
My solution was to totally wipe out my Unity3d folder and reinstall with the correct platforms.
related thread: http://forum.unity3d.com/threads/il2cpp_raise_managed_exception-undeclared-identifier.382377/
As far as I remember System.Linq is supported by iOS.
Here is a thread also exists regarding this,
Most of Linq extension methods from Linq for Collections are not working with IEnumerables on iOS since they require AOT runtime compiler which is not supported.
However there is a Linq for iOS library on Asset Store that is similar to Linq but doesn't require a runtime compiler. So you can use it on iOS.
Source: http://forum.unity3d.com/threads/linq-on-ios.84147/

Can't reference external R package from R.Net

To leverage R from my .Net website, i'm using R.Net (1.5.13).
To some extend this is working fine for me, but when i'm trying to reference an external R package (the package: tm) i'm running into deep trouble.
The following C# code:
REngine engine = null;
REngine.SetEnvironmentVariables();
engine = REngine.GetINstance();
engine.Initialize();
engine.Evaluate(".libPaths('C:/Users/Laptop/Documents/R/win-library/3.1')");
engine.Evaluate("library(tm)");
is resulting in: package or namespace load failed form 'tm'
From RStudio the command library(tm) works without any exceptions.
I tried the following steps to solve this problem:
a reinstall of R
updating packages from R studio
adding 'C:/Users/Laptop/Documents/R/win-library/3.1' to R_LIBS, R_LIBS_USER and R_LIBS_SITE
But nothing seems to help so far.
Can someone help me with this nasty problem?
Some information from sessionInfo():
R version: 3.1.0 (2014-04-10)
Platform: x86_64_w64_mingw32/x64 (64-bit)
other attached packages:
[1] tm_0.5-10
The last two issues logged at the codeplex site, here and here, relate to this problem: running R.NET from an IIS web app is a known long-standing issue. Thankfully, recently skyguy94 has done the best diagnosis and explanation of the issue to date, and as I understand proposes a workaround. You should give it a try.
Future versions of R.NET will likely offer an easier way to, er, accomodate IIS, but this is subject to the time of already busy volunteers. Meanwhile, I'll update the home page to flag the vexed issues running under IIS.
There might be other base package/s that may be failing after the package shown in the error.
In my case matrixStats was failing but in the background stats was failing to load, and that was failing because it was trying to find core R dlls inside the stats library.
I fixed the issue from another post: http://author-entry17.rssing.com/chan-9456546/all_p43.html
You have to copy over the dlls from the architecture folder into the package path as a work around.
ie copy dlls in C:\Program Files\R\R-3.1.0\bin\i386 or C:\Program Files\R\R-3.1.0\bin\x64
to
R\R-3.3.1\library\stats\libs\x64 or R\R-3.3.1\library\stats\libs\i386
as a work around.

Categories

Resources