Re: C# project adding dll have error.


Sorry, I have deleted my earlier reply, because just after I posted it I realized what could be the actual problem.
Have you tried adding your 3rd party plugin to the plugins section in the project file yet? Just open the .cryproject file with a text editor like Notepad++ or Visual Studio Code and add the plugin like this:
Yes, this is the first thing I tried, but it did not help at first.

I made more experiments, and found something interesting. It appears, that it all depends on the timing when we access the library. Because it seems to be possible to access it before it gets copied to the temporary folder. For example, assuming there is class ImportedType from the 3rd party library, if I create a local variable of that type in my plugin's Initialize() method, it crashes with "System.IO.FileNotFoundException: Could not load file or assembly...". However, if I move that local variable into plugin's OnLevelLoaded(), then it works correctly.
If I have a member variable of ImportedType anywhere in one of my classes, then it crashes even earlier, when the engine is scanning plugins, hence the error in CryEngine.Engine.ScanAssembly.

So, after all that it suddenly hit me, and I tried to rearrange the list of plugins in Game.cryproject, and put dependencies earlier in the list, before Game.dll. And it started to work!

TBH not sure if this may be considered a bug, from my perspective engine could perhaps detect dependencies beforehand and alter the order of scanning to prevent problems.
Is it a known issue?

Re: C# project adding dll have error.

yes . it is internal issue. it lacks dependency between plugins and game module. such plugin depend on another plugin. game depend on some plugins. the solution is to set dependency in plugin or game. and set loading order such as before or after game dll load . and write some code resloving loading order. then it will resolve loading order between plugins and game. in a word, dependent must be loaded beforehand.

Who is online

Users browsing this forum: No registered users and 2 guests