Problem building mods with symbolic links

Discuss modding questions and implementation details.
User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Problem building mods with symbolic links

Post by Hazelnut »

I've migrated both my mods to the virtual mod compatable format so I can develop using this new method. Unfortunately I cannot build the dfmod files anymore. When I try to build using the mod builder window, a blank asset is added to the list and then an error is logged that simply says "Asset not found: " and the build stops.

Trying to build again now throws "NullReferenceException: Object reference not set to an instance of an object" until the blank asset entry is removed.

If I save the mod build file with the blank asset showing it doesn't get written to the json. Reloading it, the blank asset gets removed. (obviously)

TheLacus, any chance you could fix this? If you want to see the mods code they're both in my github repo.
Attachments
failedBuild.jpg
failedBuild.jpg (449.55 KiB) Viewed 2584 times
Last edited by TheLacus on Fri Dec 13, 2019 8:27 pm, edited 1 time in total.
Reason: Changed title
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Problem building mods after migration to virtual mod format

Post by Hazelnut »

So I've figured out what the issue is and it's down to using a windows shortcut (created using mklink \d on windows 10) to link my mod files from their local clone of the git repo into my clone of the DFU repo in folder daggerfall-unity\Assets\Game\Mods. The dfmod.json file is now in here for virtual mods as indicated by the mod documentation, however trying to use this file to build with mod builder window the link is followed and the actual path to the file is passed into the mod builder and since this is outside the daggerfall-unity folder the call to GetAssetPathFromFilePath() fails to extract the asset path from there. (see the Invalid string warning in the screenshot above which has the real path instead of the linked one)

The work around is to have a copy of the dfmod.json where they used to go inside daggerfall-unity\Assets\Untracked\ModBuilder which is a bit of a pain, but the file could be linked across, I just liked having a single link for each mod. This probably works just fine on other OS's and is really windows being 'helpful' and parsing the link out of the path substituting the real path for you. Not sure if CreateModEditorWindow.BuildMod() method could get this path another way or not, but until it can this is something to be aware of when building mods linked acrross from git repo clones on Windows.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
King of Worms
Posts: 4753
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Problem building mods after migration to virtual mod format

Post by King of Worms »

Glad u have it sorted. Is there any link with a documentation on what this virtual mod is? I have no idea what its all about :oops:

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Problem building mods after migration to virtual mod format

Post by TheLacus »

Hazelnut wrote: Sun Sep 29, 2019 12:49 pm So I've figured out what the issue is and it's down to using a windows shortcut (created using mklink \d on windows 10) to link my mod files from their local clone of the git repo into my clone of the DFU repo in folder daggerfall-unity\Assets\Game\Mods. The dfmod.json file is now in here for virtual mods as indicated by the mod documentation, however trying to use this file to build with mod builder window the link is followed and the actual path to the file is passed into the mod builder and since this is outside the daggerfall-unity folder the call to GetAssetPathFromFilePath() fails to extract the asset path from there. (see the Invalid string warning in the screenshot above which has the real path instead of the linked one)

The work around is to have a copy of the dfmod.json where they used to go inside daggerfall-unity\Assets\Untracked\ModBuilder which is a bit of a pain, but the file could be linked across, I just liked having a single link for each mod. This probably works just fine on other OS's and is really windows being 'helpful' and parsing the link out of the path substituting the real path for you. Not sure if CreateModEditorWindow.BuildMod() method could get this path another way or not, but until it can this is something to be aware of when building mods linked acrross from git repo clones on Windows.
I'm doing the same but didn't notice any issue. Can you try to make a directory junction (mklink /j) instead of a directory link (mklink /d)?

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Problem building mods after migration to virtual mod format

Post by Hazelnut »

Sure thing, will give it a go tonight. I'm not very familiar with development on windows and the linking stuff. More used to unix symlinks.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Problem building mods after migration to virtual mod format

Post by TheLacus »

King of Worms wrote: Mon Sep 30, 2019 10:55 am Glad u have it sorted. Is there any link with a documentation on what this virtual mod is? I have no idea what its all about :oops:
It is something i introduced with version 0.10.6; it allows to test and debug mods directly from source without bundling them. Is especially useful for mods that adds custom scripts but you can also use it to test textures and other assets.

1. When you create a new mod with the mod builder it asks you where to save the manifest file. Pick a subfolder of Assets/Game/Mods, for example Assets/Game/Mods/DREAM/DREAM.dfmod.json.
2. Select all the assets that should be shipped with the mod inside the mod builder and save. You don't need to build.
3. Launch the game with the play button and DREAM will be available as a virtual mod.

User avatar
King of Worms
Posts: 4753
Joined: Mon Oct 17, 2016 11:18 pm
Location: Scourg Barrow (CZ)
Contact:

Re: Problem building mods after migration to virtual mod format

Post by King of Worms »

Thanks, nice new function!

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Daggerfall Unity 0.10.13

Post by Hazelnut »

Unfortunately I can't seem to build my mods with the mod builder anymore.

Code: Select all

Asset not found: 
UnityEngine.Debug:LogError(Object)
DaggerfallWorkshop.Game.Utility.ModSupport.CreateModEditorWindow:BuildMod() (at Assets/Game/Addons/ModSupport/Editor/CreateModEditorWindow.cs:524)
DaggerfallWorkshop.Game.Utility.ModSupport.CreateModEditorWindow:<OnGUI>m__4() (at Assets/Game/Addons/ModSupport/Editor/CreateModEditorWindow.cs:382)
DaggerfallWorkshop.GUILayoutHelper:Horizontal(VoidDelegate) (at Assets/Scripts/Editor/GUILayoutHelper.cs:55)
DaggerfallWorkshop.Game.Utility.ModSupport.CreateModEditorWindow:OnGUI() (at Assets/Game/Addons/ModSupport/Editor/CreateModEditorWindow.cs:371)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
Any chance this is related to the recent change made by TheLacus?

It seems to add a blank asset and then complain it can't find it.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Hazelnut
Posts: 3016
Joined: Sat Aug 26, 2017 2:46 pm
Contact:

Re: Daggerfall Unity 0.10.13

Post by Hazelnut »

This is similar to an issue I had before, I'd just forgotten. The .dfmod.json file has to be copied over to Assets/Untracked/ModBuilder and loaded from there. Then the build works.

@TheLacus, not sure if this is something specific to my environment or a general issue with the move to Assets/Game/Mods, maybe you could look into it when you have time?
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: Daggerfall Unity 0.10.13

Post by TheLacus »

Hazelnut wrote: Sun Dec 01, 2019 12:45 pm This is similar to an issue I had before, I'd just forgotten. The .dfmod.json file has to be copied over to Assets/Untracked/ModBuilder and loaded from there. Then the build works.

@TheLacus, not sure if this is something specific to my environment or a general issue with the move to Assets/Game/Mods, maybe you could look into it when you have time?
I cloned your repository and built both mods without issues. Note that the json file is only a container for a serialized object; if you click on Open Existing Mod Settings File you can read it from any location.

Post Reply