- Home /
Modifications I make to my packages don't save?
Every time I modify the BoneRendererUtil.cs code in the Animation Rigging package, the changes reset when I close and reopen unity, despite me saving the script.
Is there any way I can ensure my changes will be saved and remain permanent?
I had a similar problem awhile ago modifying parts of the LWRP. Ended up incorporating the modified files into my Assets folder which overwrote the package definitions.
Answer by PowerCore2000 · Sep 27, 2019 at 04:04 AM
As TerryH said, in order to have the changes made to package scripts save, you need to copy the modified file into the assets directory, and it will overwrite the previous one.
Do not understand what you mean. Just copying these files from package to assets, with or without meta files, does not work for me. Can you please explain more clearly the steps to fix this? Thanks a lot.
Sure, It was an old problem, but I'll try to recall my solution as best as I can.
I opened the package file I wanted to modify directly with Visual Studio and made my changes
I saved the modified script as a new file somewhere on my computer, like the desktop, keeping the original file the same.
I would open the original file's directory in file explorer, and overwrite it with my modified file.
Profit! The new file ran, and I could see my changes working.
I hope this explanation was more clear.
@PowerCore2000 thank you for your quick reply. The issue is that as soon as Unity is closed and opened again, the original package files are restored. Overwriting with the modified file will not change that, at least not for me. Also you do not mention placing these files in the assets folder? If you have any other ideas or instructions I would be happy to receive them. Thanks again.
Answer by justaddice83 · Nov 24, 2020 at 05:50 PM
However, copying the package is probably a bad idea, as the purpose of packages is that they can be updated independently of your project.
A better or more SOLID way might be to inherit the particular class you want to modify, and then override or wrap the methods you are interacting with.
Yes that is true and what I also do. In my case however (Vuforia), I have to disable the package in case of WebGL, so cannot inherit. I make builds for both WebGL and other targets from the same source code, so cannot remove it either. Not found a good solution yet.