[Solved] Black screen and NullReferenceException error by replacing door model

Discuss modding questions and implementation details.
User avatar
MasonFace
Posts: 543
Joined: Tue Nov 27, 2018 7:28 pm
Location: Tennessee, USA
Contact:

Re: Black screen and NullReferenceException error by replacing door model

Post by MasonFace »

XJDHDR wrote: Tue Apr 21, 2020 9:36 amHow can I find out what components were attached to the original door that I'm replacing?
MasonFace wrote: Mon Apr 20, 2020 12:43 pmSo inside the unity editor, find another door and see what components show up in the inspector for it.
^ I wasn't very clear here. What I meant was while the game is running, switch from game view to scene view and click on a door, then check the inspector to see what all components are on the door prefab. That way you know for sure which components are supposed to be on there at runtime. I think you may also need SerializableActionDoor component as well to save/load the state of the door, but I haven't checked for myself.

In general, I've found that the best way to figure out how to use one of TheLacus's modding hooks is to check his GitHub commits. He does a great job detailing how to use his code, but they can sometimes be a little hard to find. It would be great if all the modding reference was in one place, but the modding system is still constantly being expanded, so thoroughly documenting every new feature would be a pretty tall order at this point.
XJDHDR wrote: Tue Apr 21, 2020 9:36 am I've found that exporting the model as-is from Blender then adjusting the scale in Unity suits my workflow more.
BadLuckBurt wrote: Tue Apr 21, 2020 11:53 am Bad practice in my opinion but your choice.
I agree with BadLuckBurt, but I'm not judging. Dealing with the different coordinate systems between Blender and Unity is confusing and I have to look up what I need to do every time. It would be great if Blender had a setting to export to Unity properly.
I don't personally consider my project too exciting. I'm just fixing some bugs.
If you don't mind me asking, what all are you fixing? I would personally like to see a proper texture on the edges of doors instead of a flat color.

I was hoping to one day make a door overhaul mod that would replace the doors with slightly higher polycounts and create damaged variants that are used as the door gets bashed. I'd also like to make the doors open slower and more quietly if you open them while in sneak mode. And maybe a custom shader that signifies if a door is magically locked.

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

Re: Black screen and NullReferenceException error by replacing door model

Post by TheLacus »

MasonFace suggestion is on point; i think looking at the prefab should be enough but it never hurts to use the Editor to check how things work with each other. Also note that DaggerfallActionDoor lists some other components as required, which means they will be added automatically on the prefab if missing.

I updated the documentation on the Workshop website to include the explanation from that commit. I try to keep the documentation updated but it can be a demanding task.

The two main references for modding are the website linked above (which also points to some topics on the forums) and the API documentation. This one has a button named Improve This Doc on every page which can be used to add examples or additional informations (like on Unity and .NET docs) if someone wishes to help.

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

Re: Black screen and NullReferenceException error by replacing door model

Post by MasonFace »

. . . and the API documentation. This one has a button named Improve This Doc on every page which can be used to add examples or additional informations (like on Unity and .NET docs) if someone wishes to help.
I will try to make it a point to add some details to the API documentation as I continue to learn the modding system. It's a demanding task for sure.

User avatar
XJDHDR
Posts: 258
Joined: Thu Jan 10, 2019 5:15 pm
Location: New Zealand
Contact:

Re: Black screen and NullReferenceException error by replacing door model

Post by XJDHDR »

MasonFace wrote: Tue Apr 21, 2020 2:21 pm I agree with BadLuckBurt, but I'm not judging. Dealing with the different coordinate systems between Blender and Unity is confusing and I have to look up what I need to do every time. It would be great if Blender had a setting to export to Unity properly.
To be honest, the main reason I was doing it this way was because I was never able to get rotations correct when exporting my models from Blender. So I had to apply them in Unity instead and decided to apply scaling there as well. BadLuckBurt's suggestion to apply the rotations fixed that though. I was setting the rotations correctly but didn't know that they needed to be applied as well.
MasonFace wrote: Tue Apr 21, 2020 2:21 pm I wasn't very clear here. What I meant was while the game is running, switch from game view to scene view and click on a door, then check the inspector to see what all components are on the door prefab. That way you know for sure which components are supposed to be on there at runtime. I think you may also need SerializableActionDoor component as well to save/load the state of the door, but I haven't checked for myself.
I was wondering what you meant there and thanks. Should be easier to find models that way than my previous method of using Daggerfall Modelling. And yes, I did need the SerializableActionDoor script as well.
MasonFace wrote: Tue Apr 21, 2020 2:21 pm In general, I've found that the best way to figure out how to use one of TheLacus's modding hooks is to check his GitHub commits. He does a great job detailing how to use his code, but they can sometimes be a little hard to find. It would be great if all the modding reference was in one place, but the modding system is still constantly being expanded, so thoroughly documenting every new feature would be a pretty tall order at this point.
Thanks and noted.
MasonFace wrote: Tue Apr 21, 2020 2:21 pm If you don't mind me asking, what all are you fixing? I would personally like to see a proper texture on the edges of doors instead of a flat color.

I was hoping to one day make a door overhaul mod that would replace the doors with slightly higher polycounts and create damaged variants that are used as the door gets bashed. I'd also like to make the doors open slower and more quietly if you open them while in sneak mode. And maybe a custom shader that signifies if a door is magically locked.
For this particular model, a proper texture is exactly what I'm trying to do. I currently have a wood texture there (067_14-0) but I'm trying to find a suitable stone texture instead. I'm trying to use vanilla textures so that it retains the Daggerfall look while also being affected by texture packs once that Runtime Materials feature is in the game. I'm currently looking at either 087_1-0 or 122_4-0 but I need to see what DREAM did with those textures first. And to do that, I need to find a model in-game that uses one of those textures, find unpacked versions of KoW's textures or wait for the next version of DFU to be released. This whole project started with this model.

Since my project is just about fixing bugs, your door overhaul ideas are outside my scope but good luck if you ever get round to it.
BadLuckBurt wrote: Tue Apr 21, 2020 11:53 am Alright. I find FBX to be a lot cleaner than OBJ but whatever works for you.
They both have their pros and cons. OBJs give you a smaller file (so presumably loads faster unless Unity does a conversion on it) and it can be edited with a text editor whereas FBX is a binary format. I was initially also put off FBXs because I just couldn't get my meshes rotated correctly but I've fixed this thanks to your suggestion.
Conversely, FBXs can have an armature and so are required for any animated models. I've also noticed that Unity correctly generates a Box Collider for them whereas I have to manually position and size it for OBJs.
So currently, I'm using OBJs for simple static meshes and FBXs for doors and anything else I find in future that needs them.
TheLacus wrote: Tue Apr 21, 2020 5:04 pm I updated the documentation on the Workshop website to include the explanation from that commit. I try to keep the documentation updated but it can be a demanding task.

The two main references for modding are the website linked above (which also points to some topics on the forums) and the API documentation. This one has a button named Improve This Doc on every page which can be used to add examples or additional informations (like on Unity and .NET docs) if someone wishes to help.
I'll do what I can as well but it looks like the API documentation is mainly for the scripting side of DFU, which I'm not looking at right now. My C programming skills are currently rudimentary.

Post Reply