SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Discuss modding questions and implementation details.
User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Daniel87 »

Hi there and sorry in case it was said already, but I couldnt find it.

I want to get started with modding, but got stuck on setting up a new Unity Project using "Daggerfall Tools for Unity".
My Unity Version is 2018.2.21f1
My Daggerfall Tools for Unity Version is 1.6.1

When create a new project, after imported the Daggerfall Tools for Unity.unitypackage and setting the PlayerSettings Other Settings > Configuration > Api Compatibility Level*, to .NET 2.0, I receive the error:

Assets/Game/Addons/ModSupport/Editor/CreateModEditorWindow.cs(17,7): error CS0246: The type or namespace name `SimpleJson' could not be found. Are you missing an assembly reference?

I tried putting the SimpleJSON.cs from https://github.com/Bunny83/SimpleJSON into the Assets/Scripts folder as well as Assets/Plugins, but to no avail.

Did anyone else experienc this problem or have any suggestions what I could try?
It is a bit frustrating to fail before properly starting.

Thank you guys in advance for your help!

User avatar
BadLuckBurt
Posts: 948
Joined: Sun Nov 05, 2017 8:30 pm

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by BadLuckBurt »

I don't know about the Daggerfall Tools for Unity and how up-to-date those still are. I think that most of us working on mods just use the github repo for DFU: https://github.com/Interkarma/daggerfall-unity

If you clone that, open the folder in Unity and then load in the DaggerfallUnityGame scene (under Assets/Scenes) you have a DFU setup that you can run directly from Unity or build into an executable version.

- edit

If you use the DFU github, you won't need the Daggerfall Tools for Unity.
DFU on UESP: https://en.uesp.net/w/index.php?title=T ... fall_Unity
DFU Nexus Mods: https://www.nexusmods.com/daggerfallunity
My github repositories with mostly DFU related stuff: https://github.com/BadLuckBurt

.

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Daniel87 »

Okay, I am outing myself as an idiot here.

The problem had to do with case sensitivity.
import SimpleJson; is not the same as import SimpleJSON;
*facepalm*

Sorry for bothering, guys! I hope this helps other newcomers at least.
In Julianos we Trust.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Ralzar »

As I posted in earlier, Interkarma had this handy list:
  • Unity, specifically Unity 2018.2.21f1 from here.
  • Clone of the source code from GitHub. This contains all of the code and internal tools for the game, such as the Mod Builder.
  • A code editor. I recommend VSCode if you don't already have a preference.

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Daniel87 »

Ah thank you guys!
I was misunderstanding the whole thing. I thought I would need the DFU for testing purpose and the DTfU to create the mod.

You two saved me a lot of trial and error! Thank you! (:

One more question: When you create a mod (lets say something with heavy scripting for the AI), how do you create the from the DFU isolated .dfmod file containing only your mod files? Was there a tutorial I missed?

EDIT: The mod is created via the ModBuilder later on... sorry, it is 5:34 am here, maybe I should save it for another day. Sorry to bother you.
Last edited by Daniel87 on Thu Nov 28, 2019 9:34 pm, edited 1 time in total.
In Julianos we Trust.

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

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Hazelnut »

FYI, DFU uses FullSerialiser (https://github.com/jacobdufault/fullserializer) for all it's JSON stuff so that's already availiable.
See my mod code for examples of how to change various aspects of DFU: https://github.com/ajrb/dfunity-mods

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Ralzar »

Daniel87 wrote: Thu Nov 28, 2019 9:27 pm One more question: When you create a mod (lets say something with heavy scripting for the AI), how do you create the from the DFU isolated .dfmod file containing only your mod files? Was there a tutorial I missed?
A quick tutorial based on my own experiences:

After installing the stuff you need:


1: Open the master files in Unity.
2: Create a new folder with the name of your intended mod. (I prefer to create these in "Assets/Untracked")
3: Create a script file containing your mod script. Put this in your folder.
4: Click "Daggerfall Tools"->"Mod Builder"
5: Click "Create A New Mod". Do not change folders, simply write the name of your mod and click "Save".
6: Fill in the name, version etc fields in the Mod Builder window.
7: Select the script file you made in step 3. Click "Add selected assets"
8: Click "Save Mod settings to file"
9: Right-click the "Assets/Untracked/ModBuilder" folder and select "Open in explorer".
10: Copy the <modname>.dfmod.json file from the folder you just opened to "Assets/Game/Mods"
11: Click the folder "Scenes" and double-click DaggerfallUnityStartup.

If you now click the "Play" button at the top, the game will start and your mod will appear in the mod list. If the script you included works, the game will be modded when you start playing.


I really wish I had this step-by-step when I started out :D

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Daniel87 »

Thank you Ralzar!
That really helped a lot. Maybe we could include your post into the basic tutorials on the website, as I think this is really valuable "Get Started" Info. In case it is there already, I admit that I have a horrible tunnel vision :lol:
In Julianos we Trust.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Ralzar »

Not really. The tutorials that are there are a bit out of date so screenshots of menues don't match any more. And they are a lot more... wordy. Which is great if you already know how to mod, but for me who just needed to figure out how to get it up and running at all it was a big hurdle.
It wasn't until I took Hazelnuts script for Roleplay&Realism and figured out how to build that mod in Unity that I started figuring stuff out.

User avatar
Daniel87
Posts: 391
Joined: Thu Nov 28, 2019 6:25 pm

Re: SimpleJSON Error when setting up Unity Project with Daggerfall Tools for Unity

Post by Daniel87 »

Good to know! Maybe I will have a look at the same mod to get into the whole thing.
I wanted to work on a follower mod, as suggested here in the forum because I think that could be "easy" when using a pacified enemy or NPC simply following the player while keeping a minimum distance. Will look into the motion and sense scripts tomorrow and play around a bit.
In Julianos we Trust.

Post Reply