BunyaPineTree / LethalCompany_ModelReplacementAPI

MIT License
55 stars 17 forks source link

Help, I tried adding jiggle physics. #82

Closed Eddieddg1 closed 8 months ago

Eddieddg1 commented 8 months ago

So I tried adding jiggle physics and I got this in the game console:

[Error  : Unity Log] ArgumentNullException: Value cannot be null.
Parameter name: key
Stack trace:
System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) (at <787acc3c9a4c471ba7d971300105af24>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) (at <787acc3c9a4c471ba7d971300105af24>:0)
ModelReplacement.BodyReplacementBase.Awake () (at <bfc2633ab5cd45aba7f5e918649d9882>:0)
UnityEngine.GameObject:AddComponent(Type)
ModelReplacement.ModelReplacementAPI:SetPlayerModelReplacement(PlayerControllerB, Type)
ModelReplacement.PlayerControllerBPatch:ManageBodyReplacements(PlayerControllerB)
ModelReplacement.PlayerControllerBPatch:ManageRegistryBodyReplacements(PlayerControllerB&)
GameNetcodeStuff.PlayerControllerB:DMD<GameNetcodeStuff.PlayerControllerB::Update>(PlayerControllerB)

It is not this exact code thingy that I got but that is besides the point. After I failed after having added jiggle physics to a previously WORKING mod I tried to remove them and got the same issue(I forgot to make a backup :() then I tried making a new unity project and got the same thing, then I tried making a mod again with jiggle physics but the same problem. The output above is from my latest attempt at the time of writing this. HELP, BUNYA!

BunyaPineTree commented 8 months ago

This isn't related to jiggle physics, it's related to null materials. You have a material on your model that unity for some reason isn't packing into your assetbundle. No precise solution has been found for this, but people have usually been able to solve it by exporting their materials and adding them to their assetbundles, or just redoing their model.

Eddieddg1 commented 8 months ago

So what you are saying is that unity is f*cking up somewhere with the materials resulting in it returning null?

Eddieddg1 commented 8 months ago

Thank you! You made me take a closer look at the model and realize that a part of the model that I just assumed to have got shadow realmed by unity had just bugged into the model, and there fore I did not apply the material to that part.

Eddieddg1 commented 8 months ago

Now the jiggle physics does not want to work after I "Setup Model". They work just fine before I click "Setup Model" but after it´s like they were never there.

BunyaPineTree commented 8 months ago

First, I'd like to be sure that you didn't install the jiggle physics unity package. The SDK comes with scripts installed that are designed for use in lethal company, and installing the standard unity package usually results in things being broken.

If that isn't your issue, I really couldn't say what the problem is. Generally there aren't issues with jiggle physics, and if there are issues, it's usually resolved by trying again.

Eddieddg1 commented 8 months ago

(I forgot I made this and just realized again) Over the past few days I have tried countless times but have either been met by an incomplete mod generation(can give more details if you wish) or the error I created this issue page for.

Eddieddg1 commented 8 months ago

Oh and no, I used the ones coming with the ModelReplacementAPI

BunyaPineTree commented 8 months ago

Some more information on incomplete mod generation would be useful. I haven't seen that issue before. But again, that issue up there relates to bad materials, and as I don't have access to your assets I can't help you with it.

Eddieddg1 commented 8 months ago

image When I have inputted all of the necessary info such as mod GUID and assetbundle name and build I get what you see above instead of the complete one I get other times, ever since I touched the jiggle physics I most of the time get this. but only sometimes while not using jiggle physics, new unity project does not help.

Eddieddg1 commented 8 months ago

I looked through the issues and it seems to be the same as this one https://github.com/BunyaPineTree/LethalCompany_ModelReplacementAPI/issues/73 Not 100% sure tho.

BunyaPineTree commented 8 months ago

If it isn't generating the assetbundles for you, as far as I'm aware either your model replacement prefab isn't connected to your project or your unity editor is throwing a fit. There has been one or two cases in the past where people's unity editors were completely unable to build assetbundles at all, even with standard scripts unrelated to the SDK. If no matter how many times you try you can't get an assetbundle from the SDK, try building it manually with scripts like the one available here. https://docs.unity3d.com/550/Documentation/Manual/BuildingAssetBundles.html If even that doesn't work then you will have to research why your unity editor can't build assetbundles.

As for building the assetbundle yourself, the only thing inside of the assetbundle is your prefab. You should be able to find a copy of it in Assets/ModelReplacementSDK/AssetsToBuild

Eddieddg1 commented 8 months ago

Thanks for the help!

Eddieddg1 commented 8 months ago

Nothing I tried to fix it worked. Then in a last ditch effort I downloaded Unity 2023.2.14f1 and it worked like a charm! Except that when in game the jiggle physics isn't working...

Eddieddg1 commented 8 months ago

I fixed the problem wit the jiggle physics by removing the LODs I was using

BunyaPineTree commented 8 months ago

I'm surprised it worked with a version other than the game version, but I will keep that in mind whenever people have similar issues. Glad to see it's working, though.