Visual Studio support for DFUnity Types?

Post here if you need help getting started with Daggerfall Unity or just want to clarify a potential bug. Questions about playing or modding classic Daggerfall should be posted to Community.
Post Reply
FiftyTifty
Posts: 4
Joined: Thu Oct 01, 2020 5:26 pm

Visual Studio support for DFUnity Types?

Post by FiftyTifty »

Just following the guide to setting up a barebones mod: https://www.dfworkshop.net/projects/dag ... /features/

Right off the bat, after creating a new script inside the mod's folder, Visual Studio does not have support for DFUnity's scripting system. So the following line:

Code: Select all

static Mod modFyTyFirst;
Throws the error:

Code: Select all

The type or namespace name 'Mod' could not be found (are you missing a using directive or an assembly reference?)
I'm probably missing a using entry. What needs to be added to the .cs file to add support for DFUnity's API?

User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: Visual Studio support for DFUnity Types?

Post by MasonFace »

I can't seem to track it down where it's documented at the moment, but try adding the following namespaces to the very top of your script:

using DaggerfallWorkshop;
using DaggerfallWorkshop.Game.Utility.ModSupport;



I think those are the only two you'll need more basic modding stuff.

User avatar
Magicono43
Posts: 1141
Joined: Tue Nov 06, 2018 7:06 am

Re: Visual Studio support for DFUnity Types?

Post by Magicono43 »

I'd first look at other modders code and "borrow" some of their stuff as a sort of template, makes it a lot easier getting started. Here is the repository for my most simple released mod, so it has all the components to be a functional mod, but not too much extra fluff to make it any more confusing to see what the "base" parts are required.

https://github.com/magicono43/DFU-Mod_Reasonable-Blood

Post Reply