Comments (21)
Hey!, You should be able to just add a .cs file from File Explorer (I pushed a commit that implements the ShowInExplorer option in the Asset Browser):
Untitled.Project.mp4
I was so close to figuring it out! Thanks for the walkthrough!
from prowl.
Thanks, recompiling is supposed to delete all gameobjects and their components and then put them back after, but it seems something is holding onto them so it cant unload the script assembly.
from prowl.
If it doesn't already just delete all objects before recompiling, don't worry about bringing them back just yet, we don't have a scene system yet so there's no proper way to reload the world/scene
from prowl.
Howdy! I'm having trouble trying to figure out how to add a .cs script to a component. Could you walk me through how to do it? Also, I noticed while I had the editor opened and I'd change a file I'd get an error, is this similar to what you're getting when you recompile?
Looks like this is a Differant issue
Ok ill create an issue for this one
from prowl.
Was working on something else and skimmed over this code, seems like i already have the GameObject reload stuff, so something else is holding onto the Component, as long as that component is in memory (Garbage collector cant dispose of it) then we cant unload the script assembly.
from prowl.
I'm pretty sure the problem is that a Reference to the GameObject which has the component attached to it, still exists somewhere in the code even after deleting all GameObjects.
Yeah looks like that is the case, im gonna have to look into a bit more. Still not sure where the issue is coming from.
from prowl.
Yup, I think its fixed! :D
from prowl.
Awesome! Good work!
from prowl.
Ill look into this a bit more tomorrow
from prowl.
Howdy! I'm having trouble trying to figure out how to add a .cs script to a component. Could you walk me through how to do it? Also, I noticed while I had the editor opened and I'd change a file I'd get an error, is this similar to what you're getting when you recompile?
from prowl.
Hey!, You should be able to just add a .cs file from File Explorer (I pushed a commit that implements the ShowInExplorer option in the Asset Browser):
Untitled.Project.mp4
from prowl.
Howdy! I'm having trouble trying to figure out how to add a .cs script to a component. Could you walk me through how to do it? Also, I noticed while I had the editor opened and I'd change a file I'd get an error, is this similar to what you're getting when you recompile?
Looks like this is a Differant issue
from prowl.
So it looks like the error is being caused by the CSharp-Editor.dll and CSharp.dll in the temp folder. Apparently they're being locked by another thread preventing them from being deleted from temp when the project is recompiled.
The code that's causing the issue can be found in the Prowl/Prowl.Editor/EditorApplication.cs Line 143
// Delete everything under Temp\Bin
if (Directory.Exists(Path.Combine(Project.TempDirectory, "bin")))
Directory.Delete(Path.Combine(Project.TempDirectory, "bin"), true);
Directory.CreateDirectory(Path.Combine(Project.TempDirectory, "bin"));
Some of the debugging screenshots:
from prowl.
Yeah we need to delete the old assemblies so that we can recompile new ones in its place
It works as intended if you don't use the Component.
I don't think threads are involved since we don't really use threads anywhere at the moment, the project is almost entirely single threaded, which needs to change but thats another issue.
I'm pretty sure the problem is that a Reference to the GameObject which has the component attached to it, still exists somewhere in the code even after deleting all GameObjects.
from prowl.
Ok, little update, I checked _componentCache, _components, cachedObjectTypes and allObjects lists and everything looks like its being deleted properly. I think the issue is stemming from the way assemblies are unloaded. It seems like they aren't unloading at all.
Under Prowl.Runtime/ExternalAssemblyLoadContextManager.cs on line 71 it seems like the function call _externalAssemblyLoadContext.Unload();
isn't unloading. The _assemblyDependencyResolvers parameter never gets updated after it runs unlike the other unloads and disposes in the rest of the code.
My theory is that since the assembly is still in use/alive, when the code goes to delete the folder, we get the "System.UnauthorizedAccessException", because its still "in use" causing the crash. Thats where I'm at so far.
from prowl.
The assembly should be getting unloaded, since if you create the script but don't assign the component, you can keep recompiling the project and changing the script.
And the Unload, Assembly deletion, Compile and Load all works fine.
It only breaks once you add a component.,
from prowl.
Ill take a look at this issue today.
from prowl.
Seems like there can be a lot of issues for this
Newtonsoft our serializer might not support unloading assemblies it has serialized/deserialized stuff for, i guess cause it holds information for them in a cache.
from prowl.
I tried setting up the debugger and comparing the memory when it was unloaded with and without the component added and the only difference is that theres a ExternalAssemblyLoadContext1 object attached still which we already know is the case.
I don't know enough about this so I'll have to look into it later on or after you create the serialization you mentioned on discord. 🤷🏾♂️
from prowl.
Yeah, if the memory in out project no longer has the Component then it might be an external library like Newtonsoft that's caching a copy for some reason.
Im almost finished with the new serializer so once I get that in we can come back to this see if anything has changed,
from prowl.
Replacing Newtonsoft i think fixed this issue.
from prowl.
Related Issues (20)
- [Engine] Reduce the overhead of GameObjects HOT 2
- [Runtime/Gizmos] UI Runtime Solution HOT 5
- [Rendering] Google ANGLE support for Vulkan, Metal and DirectX HOT 1
- [Editor] Missing Monobehaviours HOT 1
- [Engine] SceneObjects HOT 3
- [Editor] Inspector/CustomEditors need to support Sub Assets & Runtime Generated Resource
- [Inspector] Need to rewrite how Component Drawing works HOT 1
- [Editor] I'm having problems when creating files inside folders, because they are being created at the root folder, not inside the desired folder.
- Embedding the Engine in an AvaloniaUI App HOT 5
- [Cleanup] Merge RegisterAllType methods into 1 system HOT 2
- [Editor] DragnDrop Improvement
- [Editor] Mac OSX input is not working HOT 2
- [Editor] ModelImporter Embedded Textures Support
- [Editor] Improved Prefabs
- [Editor] MacOS creating a new project fails HOT 3
- [Rendering] Mac OS Rendering is wack. EditorGUI + Runtime Renderer
- [Editor] (MacOS) crash when clicking "AssetBrowser" HOT 3
- Editor failing to load, constantly throwing errors. HOT 4
- [TODO List] New Editor and UI
- File Dialog
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prowl.