Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

[Released] uMod 2.0 - Modding support made easy!

Discussion in 'Assets and Asset Store' started by scottyboy805, Jan 6, 2017.

  1. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi, There are no plans at this time to support mobile platforms. We could possible support mobile in the future for content only mods (No scripts), but that would be quite a way off.
     
  2. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    I was looking forward to learning from your tanks example, however I am receiving errors on play indicating that the mods are not loadable by the tanks game.

    For example: [ModHost (UMod.ModHost)]: The mod ' Canyon Level ' is not loadable by this game


    Does the example project still work? Perhaps something changed in the tank demo. Any help would be much appreciated!
     
  3. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    The mods that we created for the tanks demo game are game locked meaning that they can only be loaded by the project/game that created the mod tools package (Project id information is compiled into the mod). To load the mods in your game you will need to disable game locking for your project which is quite simple. You will need to go to 'Tools -> uMod 2.0 -> Mod Tools Builder' and select the security tab. From there you can disable the 'Allow Game Locking' option and build the mod tools package via the 'Export' tab. Note that the resulting mod tools package is not required but the build process will update various uMod settings assets. After the build is complete, you should then be able to load the mods in your game as game locking checks will no longer run.

    Let me know if you have any difficulty or if you have any more questions.
     
    Graham-B likes this.
  4. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    Thank you, I'll try this. You can disregard my email.
     
  5. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    So I tried your suggestion. (for reference I am using Unity 2019.4.10)

    First I used "Export in Current Project" and the result was the same console errors as before.

    Second I specified a directory outside of the Assets folder and exported there. Result, same errors.

    Third I specified a directory inside of the assets folder. Result, same errors on play, and now I can no longer open the mod tools builder window.
     
  6. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Thanks for trying those steps.
    Exporting in assets folder looks like it has corrupted the tools setting asset. It can be fixed easily by reimporting the asset 'Assets/UMod/Resources/Editor/ModToolsSettings.asset' from the asset store. Exporting in the assets folder should not be allowed in the first place though (A path check should prevent this) so we will look into why that happended.

    As for the mod load errors: We are currently trying a test project and will get back to you shortly.
     
  7. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    I have looked into the mod load errors you reported and it is indeed caused by game locking. After speaking with my colleague, it turns out that game locking can no longer be disabled in the game by modifying the build tools settings. As a result, the only way to get around the issue was for us to rebuild all mods for the game with game locking disabled. This means that you can now load them from any project. I have attached the updated mod files for you but we will also be submitting an update shortly with the changes.

    As a side note: When loading the 'Canyon Level' mod, you may receive a number of warnings such as:

    'Failed to relink game asset with guid...'

    If this occurs, you will need to rebuild the mod tools package like you did in your second step. This will cause a resource database to be generated which is required for the asset sharing feature.

    Let me know if you have any more issues.
     

    Attached Files:

  8. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    Thanks for your prompt responses! This fixes the initial errors, but now when I choose any single mod and then select "Play Game" I am met with a new wall of console errors. (these occur for all mods)


    I tried rebuilding the mod tools package as you suggested, but this didn't resolve these errors.
     
  9. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    On a side note, I am unable to use the example scenes included with uMod either, they appear to be affected by the same issue. (the mod is not loadable by this game)
     
  10. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.0 - Moddable Tanks Example Game 1.0.1 has been submitted to the asset store. All mods have been rebuilt with game locking disabled so that any project/game can load them.
    Ok, It looks like the mods are now loading atleast.
    These new errors you are getting mean that the various moddable elements in the scene have not had their naming scheme generated which is used to map moddable content onto a specific object. If you go to 'Tools -> uMod 2.0 -> Settings', then switch to the 'Moddable' tab, then click the 'Edit' button next to 'Asset Naming Scheme', you should see the following entries:

    NamingScheme.png

    If those are missing then you may need to open the scene at 'Assets/uMod 2.0 - Moddable Tanks/Game/CompleteGame.unity' and hopefully this will update the naming scheme.

    It is strange that we did not have the same issue when we tested earlier, although now I think about it, I had to open that scene to add to the build settings so maybe that fixed it without me knowing.

    Yes, those mods are still game locked. We will address that in the next update for the main asset.
     
  11. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    Thanks! Opening the CompleteGame scene updated the naming scheme, and I no longer get those errors.

    Now the only problem I have is loading the 'Canyon Level' mod, I am getting the 'Failed to relink game asset with guid...' warnings you mentioned. However after rebuilding the mod tools package as per your suggestions, I still get the console warnings, and the level loads empty. Any other ideas?

    Not sure if it's related, but I also encounter this popup sometimes when rebuilding the mod tools.

    Where should I be building them to? I'm still confused as to whether I should enable "Export in Current Project" or not.
     
  12. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Glad the naming scheme issue is fixed.

    Can you check that the asset sharing options in the mod tools builder wizard are setup as shown here:

    AssetSharingSettings.png

    These should be setup automatically when importing the 'uMod 2.0 - Moddable Tanks' asset but maybe that is not the case for you.

    With those options selected, it should just be a case of exporting the mod tools package which will create the necessary resources for asset sharing. You should see a message like' Generating shared asset database' in the progress window.

    As for the export path: It can be anywhere you like. Just enter a valid file name or file path such as 'ModTools.unitypackage' and that will be fine. As long as the tools builder runs, the necessary settings assets in the game project will be updated.
     
    Last edited: Sep 24, 2020
  13. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    Everything was disabled under asset sharing options. Enabling them and rebuilding the mod tools seems to have fixed it, I can load the canyon level now!

    Thanks for the help!
     
  14. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    No problem, glad it is all working now.
    I’m not sure why those options did not import correctly but we will look into that.

    Let me know if there is anything else.
     
  15. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.0 - Moddable Tanks Example Game 1.0.1 has been submitted to the asset store. All mods have been rebuilt with game locking disabled so that any project/game can load them.
     
    peterpan2022 and Graham-B like this.
  16. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    I am extremely confused by the "Hangars To Circus Tents" example. Where do we define what parts of an asset can be overridden?

    Building01 has it's material color modified. But the Moddable Content scripts don't seem to support this the way they are set up. Is the example configured properly? (the model is named material, material is named texture, texture is named animator? The asset type is also set to model )

    Strangely we are able to supply a material and it works in this example.

    I am just confused as to how and why this is working, and cliff is setup this way too. Why it doesn't work if I change the names to match Building02 example which has names that seem to make more sense.

    Thanks again for all the help!
     
    Last edited: Sep 24, 2020
  17. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi again,
    It looks like the configuration is all wrong which is likley why you are so confused. I suspect it is related to a recent update where we added support moddable meshes that may have caused the configuration to become out of sync. We will resubmit the whole project shortly with the correct configuration but if you are interested in fixing the problem yourself then here is what you need to do:

    1. Open the naming scheme window 'View / Edit Naming Scheme' and expand the 'Asset Type Naming Scheme' foldout. Ensure that each asset type has the correct name:

    Mesh Asset : 'mesh'
    Model Asset : 'model'
    Material Asset : 'material'
    Texture Asset : 'texture'
    AnimatorController Asset : 'animator'


    Some of those were incorrect when we investigated.

    2. Go to the folder 'Assets/uMod 2.0 - Moddable Tanks/Game/Modding/Sharedprefabs' and select the prefab named 'Building01'. Find the 'ModdableContent' component and ensure that 'AssetType' is set to 'Material'. Make sure that the 'Target Moddable Component' is also set to 'Building01 (Mesh Renderer)'.

    Find the 'Moddable Content Naming Scheme Override' component and remove it. Then go to 'Add Component -> Scripts -> UMod.Moddable -> Moddable Content Naming Scheme Override'. This will add the naming scheme component with a fresh configuration. Setup the names like so:

    Moddable Override Content Folder : 'Overrides'
    Moddable Override Content Name : 'Building01'


    Hit the 'Apply Naming Overrides' button to update the naming scheme.

    3. In the same folder, select the prefab named 'Building02'. Make sure the 'Asset Type' is set to 'Model' for this object and that the 'Target Moddable Component' is set to 'Building02 (Transform)'.

    Remove and re-add the 'Moddable Content Naming Scheme Override' component again and ensure that the component has the following names:

    Moddable Override Content Folder : 'Overrides'
    Moddable Override Content Name : 'Building02'


    Hit the 'Apply Naming Overrides' button to update the naming scheme.

    4. In the same folder, select the prefab named 'Cliff'. Make sure the 'Asset Type' is set to 'Material' and that 'Cliff (Mesh Renderer)' is assigned as the 'Target Moddable Component'.

    Remove and re-add the 'Moddable Content Naming Scheme Override' component again and ensure that the component has the following names:

    Moddable Override Content Folder : 'Overrides'
    Moddable Override Content Name : 'Cliff'


    Hit the 'Apply Naming Overrides' button to update the naming scheme.

    5. Run the game and all moddable content should be applied correctly. Hopefully the setup will make alot more sense now that the correct asset names and types are used.


    I suspect the reason it was working with an invalid configuration was that only the UI elements were out of sync. I believe that the saved configuration was valid but was being displayed incorrectly as the 'Asset Type' enum had a new value added. It likley shifted all the asset names by 1 index when displaying the UI leading to all the confusion.
     
  18. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    Thanks for the clarification, makes more sense now.

    Can multiple Moddable Content components be added to a single prefab? Lets say I want to allow modding of the model, material and animator simultaneously.
     
  19. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    No problem and sorry you are facing all of these issues. An update is on the way.

    Yes, you can have multiple 'Moddable Content' components on the same game object. You just need to make sure that each component has a unique 'Asset type'. Note that you can only have one 'Moddable Content Naming Scheme Override' component though but it contains naming options for all supported asset types.
     
    Graham-B likes this.
  20. pasteurnik

    pasteurnik

    Joined:
    Feb 23, 2019
    Posts:
    15
    Hi! Can someone please help? I bought both UMOD2.0 and UMOD2.0 Roslyn C# extension. So I imported both of them, solved the error with Plugin Conflicts.
    And now, I tried to follow the example
    Code (CSharp):
    1. using UnityEngine;
    2. using RoslynCSharp;
    3. using UMod.Scripting;
    4. public class Example : MonoBehaviour
    5. {
    6. private ScriptDomain domain = null;
    7.  
    8. // The C# source code we will load
    9. private string source =
    10. "using UnityEngine;" +
    11. "class Test : MonoBehaviour" +
    12. "{" +
    13. " void SayHello()" +
    14. " {" +
    15. " Debug.Log(\"Hello World\");" +
    16. " }" +
    17. "}";
    18.  
    19. void Start()
    20. {
    21. // Create the domain - We are using C# code so we need the
    22. //compiler
    23. domain = ScriptDomain.CreateDomain("MyTestDomain", true);
    24.  
    25. // Compile and load the source code
    26. ScriptType type = domain. CompileAndLoadMainSource(source);
    27. }
    28. }
    29.  
    But Unity gives me and error saying that ScriptDomain.CreateDomain() method doesn't exist. So what to do now?
     
  21. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    Thanks for purchasing our assets.
    Using Roslyn C# with uMod 2.0 is a little different to the standalone Roslyn C# asset because ScriptDomains can only exist when a mod is loaded (Each mod has their own script domain which is created automatically and accessed via the 'ModHost.ScriptDomain' property).

    If you want to compile source code without a mod loaded then you will need to use the compiler directly. Here is a quick example:

    Code (CSharp):
    1. using UnityEngine;
    2. using UMod.Scripting;
    3. using RoslynCSharp.Compiler;
    4.  
    5. class Example : MonoBehaviour
    6. {
    7.     void Start()
    8.     {
    9.         // Create the compiler
    10.         RoslynCSharpCompiler compiler = UModCompilerFactory.CreateCompilerServiceFromSettings();
    11.  
    12.         // Compile the source code
    13.         CompilationResult result = compiler.CompileFromSource(...);
    14.  
    15.         if (result.Success == true)
    16.         {
    17.             // Load the assembly and now you can use the same API to find types and execute methods etc.
    18.             ScriptAssembly assembly = new ScriptAssembly(result.LoadCompiledAssembly());
    19.         }
    20.     }
    21. }
    You can find some more code examples in the folder 'Assets/UMod-AddOns/UMod-RoslynCSharp/Examples/ExampleScripts/'.

    I hope that helps you. Let me know if there is anything else.
     
  22. pasteurnik

    pasteurnik

    Joined:
    Feb 23, 2019
    Posts:
    15
    Thank you a lot! It works like charm!
     
    scottyboy805 likes this.
  23. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.7.3 has been submitted to the asset store. This version includes minor bug fixes:
    • Fixed a bug in the moddable content system where some scene objects and prefabs could be unregistered from the naming scheme causing moddable content to not be applied.
    • Fixed a bug in the moddable content system where the moddable target override path could become invalid in some cases.
     
  24. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.7.4 has been submitted to the asset store. This version fixes a bug in the script interface system where calling one of the 'GetComponentProxy' methods on a gameobject would not work correctly. Passing a base type to these methods would return a script proxy of the same type, meaning that calling virtual or abstract methods could fail with a target exception.
     
    peterpan2022 likes this.
  25. Graham-B

    Graham-B

    Joined:
    Feb 27, 2013
    Posts:
    301
    Does uMod support skinned meshes and animation?
     
  26. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    Yes, uMod 2.0 fully supports skinned meshes and animators.
     
    Graham-B likes this.
  27. bugscuffle

    bugscuffle

    Joined:
    Dec 8, 2015
    Posts:
    73
    I want to like this one, but I cant get it to work on UNIty 2019.3.13f1 I keep getting a ton of Namespace errors.. I dont see an editor up there.. jeez. Tried to contact support, but on the send mail page it shows the "Are you a robot" thing, but then there is no "Send" button.
     

    Attached Files:

  28. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    It looks like you do not have uMod 2.0 installed in your project. You simply need to download and import the latest version from the asset store and the errors should disappear. The main uMod 2.0 asset is not distributed with the free tanks demo since it is a paid asset.

    Let me know if you are stillhaving issues or if you have any more questions.

    Thanks for reporting the contact form issue. We will look into that asap.
     
  29. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    Hi is it possible to fully export a scene as a mod and load scene at runtime??
     
  30. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    Yes, this is no problem at all. Scenes, prefabs etc. are all fully supported by uMod 2.0, as well as allowing scripts to be added to create new behaviours.

    Let me know if you have any more questions.
     
  31. witcher101

    witcher101

    Joined:
    Sep 9, 2015
    Posts:
    516
    lets say i made a new scene with completely new skinned meshes and static meshes and scripts. And then i package it as a Mod file and send to other user. ANd if other person downloads it will he be able to play the scene as it was made by orginal sender
     
  32. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Yes that will work just fine, although there are a couple of things to be aware of:
    1. The user who you are sending the mod to will need to have a built version of a Unity game that uses uMod 2.0, or purchase uMod 2.0 from the asset store themselfs in order to load the mod. Obviously the first method is the expected use case because you don't want your users requiring licenses for our asset. You could simply create a very simple game build that scans a particlar folder for any mod files and then loads them at startup.
    2. The mod must use the same Unity version that was used to create the game. This is enforced to ensure that issues with materials and shaders do not arise.
     
  33. peterpan2022

    peterpan2022

    Joined:
    May 9, 2015
    Posts:
    177
    Would it be possible to include the .meta file for a pre-existing .dll that gets included in a mod? I'm trying to share prefabs between mods, such that when you are creating a mod that references another mod, you can use that referenced mods prefabs (imported via a separate .unitypackage). The problem I run into is, when the original mod is "unpacked" into the derived mod via "reference mod", the pre-existing DLL (not the generated umod assembly) gets a brand new .meta file, with a new GUID. So the existing prefabs (that were built using references to components defined in the pre-existing DLL) can't find the DLL GUID they are expecting, even though the DLL is there via "referenced mod". So the "derived mod" modder can't build their map using prefabs defined in the first mod.

    Or to explain it maybe better:
    I create a Tree package, and Tree.cs script, which results in a Tree.dll being compiled into TreeProject/Library/ScriptAssemblies/Tree.dll

    I create a Tree mod, and drag Tree.dll from the script assemblies into the mod folder (this causes an error in the console, but I ignore it)
    Build the mod, it gets built to TreeMod.umod somewhere on disk
    I use an asset store project to switch my Tree prefab to point to the DLL, instead of Tree.cs
    Export the tree prefab into TreePrefab.unityPackage

    --Okay, new project--
    I create a new mod called Forest. I point it to reference the TreeMod.umod file. Tree.dll gets unpacked into ForestProject/Assets/ModTools/UMod/ResourcesGenerated/Referencing/AssemblyCache/Tree.dll
    -->Tree.dll gets a new .meta with a new guid
    Assets/Import package/custom package
    Select TreePrefab.unitypackage
    TreePrefab gets imported, but is broken, even though Tree.dll exists in the project.
    Manually replacing the .meta file with the one from the Tree project works, and the engine can load a scene built in the Forest mod, which populates the level with Tree prefabs. But replacing the .meta file is where things become inconvenient.

    I think this would be a really useful ability, for modders to be able to build with eachothers prefabs. Its possible to do currently, but requires some extra steps and ignoring a warning.
     
  34. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    It should already be the case that the correct metadata file is used when referencing another mod assembly. uMod 2.0 will serialize the metadata file for any assembly assets for this purpose. Then when you add a reference to an existing mod, the referencing system should import any assemblies with their metadata files into the project so that you mod code can access it.

    I assume for the first mod you are creating a script named 'Tree.cs' inside the mod folder? If so, the the Unity generated assembly inside the 'ScriptAssemblies' folder is not used at all because it is compiled for debug mode with editor references. Instead, uMod 2.0 will compile it own version of the code into an assembly named something like 'umod-compiled-...' and this will be included in the mod. It is also important to note that mod scripts are not serialized in the traditional Unity way using guids as this approach cannot handle new scripts that have been created separate from the game (You always end up with the missing script warning). Instead, uMod 2.0 will use its custom serialization system to handle script references which get linked at build time, and then resolved on demand when the mod is loaded.

    With this in mind, script components defined in another mod should be handled by uMod 2.0 serialization when the mod is built which is metadata independant. When you build a mod which references another and has one or more of its scripts attached to an object, here is the process that should occur:
    1. Referenced mods are loaded/refreshed by the build engine for access to script assemblies/metadata
    2. uMod 2.0 will compile any scripts that are included in the current mod.
    3. The uMod 2.0 serialization system will process every mod prefab and scene to serialize script references.
    4. The mod file is generated which now has a dependency on the referenced mod. Ie. cannot be loaded without first loading all referenced mods.
    At runtime:
    1. The mod metadata is loaded by the uMod runtime to determine load configuration any references.
    2. Referenced mods are resolved and loaded.
    3. User attempts to load a mod scene or instantiate a mod prefab.
    4. The uMod 2.0 serialization engine will be invoked to deserialize any script references. As mentioned previously, this proces is metadata independant so as long as all referenced mod assemblies have been loaded, the script should resolve without any issue.
    If you are getting missing scripts at runtime, using references or not then it sounds like a bug rather than a missing feature. If possible, could you send us the 2 mod projects that you are using to info(at)trivialinteractive.co.uk and we can look into it further.

    Edit: This reply assumes that the tree assembly or script is being included in the mod via the mod folder. If this is not the case (The assembly is reference-only and exists outside of the mod folder), then metadata referencing is indeed used, but the assembly must also be present in the game project.
     
  35. Elfinnik159

    Elfinnik159

    Joined:
    Feb 24, 2013
    Posts:
    144
    Hi,
    For the past few months I have been using UMod on my project to create downloadable content. I also prepared a toolkit (using UMod) for players to create mods for my game.
    Distribution of mods is done through the Steam Workshop.

    However, while testing, I ran into a very important security issue as well as a serialization issue:
    1. Security. Since I allow anyone to download mods, I have to make sure that dangerous code cannot be loaded.
    I know there are security checks, however if I understand correctly, is this just a list of denied namespaces? Besides the fact that I may not know some dangerous libraries, the user can write his own dll with dangerous code. What's the best way with UMod in this case?
    Can I disallow all namespaces except UnityEngine, System.Colelctions, etc. and user created?
    If this is not possible, can UMod provide (to my script) a list of the namespaces in use? For example, so that when loading a mod, the user will see (from my script) a warning and a request to confirm the download if the mod contains unknown (for the game) namespaces?
    2. UMod can't serialize LayerMask? All LayerMask are reset to None. Is this a bug or is there a reason why they cannot be serialized (as far as i know, LayerMask is just an EnumFlags)?
     
    Threeyes likes this.
  36. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,

    1. uMod 2.0 will security check all code before allowing it to be loaded into memory. These checks are based on restrictions you define which can be namespace, type and member restrictions. Here are the restrictions that we recommend for most users, as they prevent the use of potentially harmfull API's:
    Assembly Reference Restrictions: Blacklist
    • UnityEditor
    • Mono.Cecil
    Namespace Reference Restrictions: Blacklist (.* is recommended to also blacklist child namespaces)
    • System.IO.*
    • System.Reflection.*
    • System.Runtime.InteropServices
    Type Reference Restrictions: Blacklist
    • System.AppDomain
    • System.Threading.Process
    Member Reference Restrictions: Blacklist
    • UnityEngine.Application.Quit

    You can input these restrictions into the security resitrictions window which can be found by going to 'Tools -> uMod 2.0 -> Mod Tools Builder' - Security Tab - 'Edit : Security Restrictions Asset'.

    With these options, it will not be possible for your modders to load external code, unless it has been imported via the uMod 2.0 build pipeline. If your modders choose to place pre-compiled managed assemblies into the mod folder, then these assmblies will also be security checked by uMod 2.0 at the bytecode level before being compiled into the mod.
    Using the blacklisting restrictions above, modders will not be able to write code that uses reflection or processes, meaning that external code and processes cannot be accessed. PInvoke is also disabled by default so modders will have no luck trying to access native code either.

    If you want to explicitly list which API's modders can access, then that is also possible via the security restrictions window. For your given example of namespaces, you can do the following:

    • Under the 'Namespace Restrictions' foldout, change the option 'Default Security Behaviour' to 'Deny'. This will cause all non-listed namespaces to be disallowed.
    • Add your selected namespaces to the 'Whitelist' section.
    • Rebuild your mod tools package and your restrictions will now be in place.
    Code security checks will run at build time where possible, allowing modders to fix their code before exporting a valid mod (The build process will fail if such errors exist). As a result, it is usually not required to display a message to the modder in your game about such issues. The modder will see a detailed report in the editor console if their code breaches one or more security restrictions.

    2. Thanks for reporting this issue. It looks like the LayerMask type will require a custom uMod serializer in order to be handled correctly due to the way it is defined. We will add this in the next update.

    I hope this helps you. Let me know if you have any more questions.

    Edit: The LayerMask serialization issue has now been fixed and an update submitted. If you need the fix asap then feel free to email us at info(at)trivialinteractive.co.uk where we can send you the update direct.
     
    Last edited: Jan 26, 2021
    Elfinnik159 likes this.
  37. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.7.5 has been submitted to the asset store. This version includes:
    • Added serialization support for LayerMask type.
    • Bug fixes and improvements to code security engine.
     
    Elfinnik159 likes this.
  38. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.7.6 has been submitted to the asset store for review. This version includes:

    Added support for mod icons as part of the mod metadata. Modders can now select a Texture2D image from the project to be used as the mod icon which is stored in the metadata aspect of the mod (The mod does not need to be loaded in order to acces this icon). The icon can then be accessed via the 'IModInfo' interface and will also be displayed in the mod viewer window:

    ModIcon.png
    Other changes include:
    • Redesigned the mod tools builder process to fix stability issues and inconsistent behaviour between Unity versions.
    • Building a mod tools package is now a much quicker process.
    • The mod content folder selected in the 'Content' section of the mod tools builder wizard will no longer be modified at all during the build process. This is due to some previous cases where content from this folder could potentially be deleted/corrupted.
     
    Sethtek_Dev likes this.
  39. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.7.7 has been submitted to the asset store for review. This version adds serialization support for types Vector2Int and Vector3Int.
     
    Rotary-Heart likes this.
  40. Kondor0

    Kondor0

    Joined:
    Feb 20, 2010
    Posts:
    584
    Hi, I just installed this asset in a project (Unity 2019.4) and I get an error.

    This line in UIModBrowse.cs:

    Code (CSharp):
    1. UMod_InterfaceAssembly.Scriptable instance = host.Assets.Load<UMod_InterfaceAssembly.Scriptable>("TestScriptable");
    is giving me an error that the namespace UMod_InterfaceAssembly could not be found.

    Since apparently this is just an example I could dissable the line and keep checking the asset but I thought you could tell me if I missed something. I didn't see anything related to this problem in the documentation.
     
  41. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    Thanks for reporting this issue.
    It looks like there was a problem with the latest version submission, since the code you posted is for testing only and should not be included. We will fix that asap but you can safley disable that code, or not import the examples for the time being.
     
  42. Tiessa

    Tiessa

    Joined:
    Nov 24, 2015
    Posts:
    2
    I started up a new project with uMod2.0 and the scripting add-on. I am receiving "Multiple pre-compiled assemblies with the same name..." errors.

    Example:
    Multiple precompiled assemblies with the same name Trivial.Mono.Cecil.Mdb.dll included or the current platform. Only one assembly with the same name is allowed per platform. (Assets/UMod/Plugin/Trivial.Mono.Cecil.Mdb.dll)
    Multiple precompiled assemblies with the same name Trivial.Mono.Cecil.Mdb.dll included or the current platform. Only one assembly with the same name is allowed per platform. (Assets/UMod-AddOns/UMod-RoslynCSharp/Plugin/Trivial.Mono.Cecil.Mdb.dll)

    Deleting the duplicates of course causes a big old mess.

    Unity versions I have tried this on: 2020.2.4f1, 2020.2.3f1, 2020.1.16f1
    uMod version: 2.7.7
    uMod Runtime Compiler Add-On: 1.0.0

    Both of those are the current version they are showing me in the asset store. I have no other assets installed. I've done this multiple times with completely fresh project creations.

    Any suggestions for resolving this?
     
  43. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Hi,
    Thanks for reporting this issue.
    We were able to reproduce the problem and have now fixed the issue. We will be submitting an update shortly for this but if you want to fix the problem yourself, then here are the steps:
    1. Create a project backup as a precaution.
    2. Delete the assembly asset at 'UMod-AddOns/UMod-RoslynCSharp/Plugin/Trivial.Mono.Cecil.dll'
    3. Delete the assembly asset at 'UMod-AddOns/UMod-RoslynCSharp/Plugin/Trivial.Mono.Cecil.Pdb.dll'
    4. Delete the assembly asset at 'UMod-AddOns/UMod-RoslynCSharp/Plugin/Trivial.Mono.Cecil.Mdb.dll'
    5. Delete the assembly asset at 'UMod-AddOns/UMod-RoslynCSharp/Plugin/Trivial.CodeSecurity.dll'
    6. You may also need to delete the assembly at 'UMod-AddOns/UMod-RoslynCSharp/Plugin/System.ValueTuple.dll' depending upon which packages you are using. There is more information about this in the user guide under the topic named 'Plugin Conflicts'.
    7. Restart the editor, since it will likley be in a bad state after modifing all of these assembly assets.
    8. All errors should now be gone and the examples will work as expected.
     
  44. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.0 - Runtime Compiler Add-On version 1.0.1 has been submitted to the asset store for review. This version fixes a number of conflicting assemblies which could generate compiler errors when importing the package.
     
    Last edited: Feb 16, 2021
  45. Tiessa

    Tiessa

    Joined:
    Nov 24, 2015
    Posts:
    2
    You are amazing! Thank you for the quick turn-around! I appreciate it.
     
    scottyboy805 likes this.
  46. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    We have just setup a discord server for uMod 2.0 and a few other assets of ours so that we can offer better and faster support. We would love for you to come and join and hang our with other users of the asset and maybe share any cool projects you are working on.
     
    Last edited: Mar 21, 2021
    peterpan2022 likes this.
  47. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    826
    Link doesn't work.
     
  48. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    Thanks for letting me know. I have updated the link and it will never expire now.
    Discord Server.
     
  49. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.7.9 has been submitted to the asset store and should be available for download within a few days. This version includes:
    • Fixed a bug where UI component events would not be serialized correctly.
    • Fixed a bug where the open scene could be saved when changes were discarded, causing the scene to remain in the pre-discarded state.
    • Minor bug fixes.
     
    peterpan2022 likes this.
  50. scottyboy805

    scottyboy805

    Joined:
    Apr 10, 2013
    Posts:
    1,053
    uMod 2.8.0 has been submitted to the asset store for review. It should be live within a couple of days and includes the following changes related to code securtiy:
    • Fixed a bug in the code security engine where setting the default security behaviour for namespaces to 'Deny' could cause some user defined namespaces to be flagged as violations.
    • User code can now define types inside restricted namespaces such as 'System.IO' without being flagged as a security violation. The security checks will apply only to externally referenced types.
    • Fixed a bug in the code security engine where generic type references passed as generic arguments to method calls could cause an unexpected empty security violation to be logged.
    • The code security engine now supports mdb and pdb debug symbols to provide better reports on illegal code, including file name, line number and column information. This feature will require further work in the future to generate the debug symbols files for assemblies, probably using pdb2mdb.
     
    peterpan2022 likes this.
unityunity