Unity crashes every time when it reloads Script Assemblies - c#

When I use VSCode to modify the C # code, or click the Run button, unity reloads the script assembly. This is causing unity to get stuck.
I tried to delete unnecessary packages in the Package Manager and modify the playback mode options. But it didn't work.
I don´t want unity be stuck when reloading the assembly.

Unity will freeze for a while when loading scripts. If it takes longer than say 2 minutes for a small project, thats a problem. However, it could also be that your computer is underpowered. You can disable auto reloading assemblies by going into edit/preferences/general/autorefresh. If you have many packages that aren’t compiled beforehand, that could also be a problem. I would recommend just being patient. If you need to, you can pay for unity cloud compilation.

Related

unity scripts location after build

hello i wanted to know where are unity scripts stored in a build...
actually i want to give update to my game but saw that there's no proper way to do it without giving full update... assetbundles cant import executable code... so what i came up with is make an entire new application/unity project which acts like a launcher to my game and it will fetch a json from server with all filenames and latest versions and compare them to the filenames and versions on disk... then it downloads and replaces any missing or old version files from the disk with streamwriter and all... then it will call to start the actual game's exe and quit itself...
Now what the problem is that i dont know where are scripts(the custom scripts we made during development) are compiled and stored to as dll or any other files so i can look out for them because i noticed there are a lot of system(default) dll in unity build and i dont want to iterate through them every time my application checks for an update...
Edit:
it strike me sometime after... i also wanted to know if all of our scripts are compiled(and stored in a build) in one dll or whatever file or as separate dlls. cuz say if i have scripts almost extending to 50mb and if i give even a minor update, downloading the whole 50mb dll wont be worth for the update mechanism the way i vision it to be...
Please ignore my grammar. english is my second language
By default Unity compiles everything game related into the assembly: Assembly-CSharp.dll
All the assemblies are located in /GAME NAME_Data/Managed/
You can however split your code up into different assemblies using Assembly Definitions.

Convert all C# scripts to dll in unity project automatically

I have a pretty large project where different scripts are available and attached with different game objects in the hierarchy. Now I want to make dll of all files. I found unity official guide that involves lots of steps that I have to repeat for every script. Not only this but I have also attached each dll to gameobject again then, need to remove the same script whose dll i have converted. And if there any setting on the inspector i have to follow again. My question is that is this the only way to do this job? Is there any automatic way available? that convert all my scripts into dll? within unity ?
I would suggest you to split all stable and reusable code into unity packages or at least into separate folders where you can create assembly definitions files so all scripts inside won't compile every time you change something in a different place. Start here: https://docs.unity3d.com/Manual/ScriptCompilationAssemblyDefinitionFiles.html

Unity Editor freezes for couple of seconds when hitting play - Firebase.Editor error

I am building an Android game and the problem is that any time I click Play in Unity editor, it has a delay of 6-10 seconds (and maybe more) at the very beginning (like freezing) every time I make a change and build the project which is very frustrating and time consuming (only in editor though, on Android devices it's fine). In this link, it looks like there are more people having this problem. So, one suggestion was to remove Google.IOSResolver_v1.2.156.dll and it's .meta files from ExternalDependenceManager folder. I tried it and indeed it's loading much faster which clearly points out that there is a problem with IOSResolver in Unity Editor. Removing the files, bring me following errors:
Assembly 'Assets/Firebase/Editor/Firebase.Crashlytics.Editor.dll' will not be loaded due to errors:
Reference has errors 'Firebase.Editor'.
Assembly 'Assets/Firebase/Editor/Firebase.Editor.dll' will not be loaded due to errors:
Unable to resolve reference 'Google.IOSResolver'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
I can ignore them since they are not really causing any problems, but is there any other solution?
Maybe completely remove iOS Firebase plugin? I already installed only Android plugins though.
I checked also this link but doesn't really helped me.
Note that I already tried with a completely empty project using Firebase causes the same problem.
UPDATE
Installed the latest version of EDM4U (external-dependency-manager) 1.2.157 and the problem persists.
I had the same issue with AdMob earlier. Make sure the IOS plugin is installed by going into Unity Hub -> Installs -> 3 dots on Unity version -> Add Modules and select iOS Build Support. That fixed for me even though I don't develop for IOS.

Easiest way to use a managed library in Unity3d that's part of the solution

I have a Unity creates solution for UWP (hololens actually, not sure if it matters).
Most of my work is done on a class library that contains my logic. I want to call from the unity C# scripts into this class library I am using. Since the Assembly-csharp DLL gets recreated completely every time, I obviously can't just add a project reference in there.
What's the best way to achieve this?
What I've found so far is that I can pull the actual DLL binary of my library DLL into the Unity Assets folder, at which point it actually does get referenced in the Assembly-csharp project - however - the DLL actually gets copied to a separate location (\Unprocessed\MyLibrary.dll). That means I need to copy my project there everytime I make a change (or re-publish from Unity which takes a bunch of time).
I know I can have a post-build stage that will copy the file - however - is there any more "correct" way? The way this works now (dropping a DLL into the Assets) also has other disadvantages such as making building a certain flavor much harder than it should be.
Thanks
That is the correct way: you put the library DLL in Unity's Asset folder, and never touch the generated C# project.
Consider that in most common scenarios, both the library itself and the Unity code referencing it would change so a rebuild of the Unity project is a natural part of the process. If that takes too much time, it is usually advisable to create a dedicated, smaller Unity project to quickly iterate through the DLL development cycles.

Creating Wp8 Unity Plugin in Unity 5.0

I have a windows phone 8.0 plugin created for an app. This app worked perfectly fine in Unity 4.5. I recently updated my Unity to 5.0. I also saw all the needed alterations.
Initially, we needed to create two plugin dlls. One actual and one empty simply like an interface for the editor. This went pretty well in unity 4.5
Now i open the same app in Unity 5.0 by upgrading it. and i am unable to build it for wp8 anymore. I set the inspector platforms correctly to WP8 player for my plugin dll.
But, i keep getting errors like ::
1. Plugins are colliding.
2. There are errors in the script (which are actually not)
3. Cannot load classes from module.
4.System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
etc.
Can anybody help me? I have tried several things already but none seems to work.
I tried :
1. Reimporting everything
2. Rebuilding the dlls.
3. Removing the empty interfaced dll for editor
4. Changing the folder structure for plugins. (Default being
Assets/Plugins/WP8)
I am stuck here since two days now.
Well, it's too late to reply. But anybody else stuck in same problem may get help.
One should know that WP8 Plugins are based on real and fake dlls in order to work in Unity Editor.
In Unity 5, you can specify platform to dll, irrespective of folder structures. However if you put dll in Assets->Plugins->WP8. Unity will mark it as WP8 dll.
Solution is,
1- Put Fake dll in Assets->Plugins->AnyFolder->plugin.dll, where any AnyFolder is other than WP8 folder. Mark it as Editor instead of Any Platform (from inspector [Select platform for plugins]).
2- Put Original dll in Assets->Plugins->WP8->plugin.dll, mark it as WP8Player
3- Keeping original dll selected, in Platfrom Settings [Inspector] modify settings like, CPU -> Any CPU, check mark on Don't Process, Select placeholder.
Placeholder drop down would show the path of fake dll, just set it.
Now you are all done :)
You must set the editor DLLs to "Editor" instead of "Any Platform" and the WP8 plugins to "WP8Player" in the plugin settings.

Categories