Interkarma / daggerfall-unity

Open source recreation of Daggerfall in the Unity engine
http://www.dfworkshop.net
MIT License
2.7k stars 328 forks source link

Fixed "readOnly" issue with GetMobileBillboardMaterial #2576

Closed KABoissonneault closed 7 months ago

KABoissonneault commented 7 months ago

When using mods that provide lots of texture replacements and new textures, logs are filled with the message "Texture {name} is not readable."

image

The root of this is a change I made in 2021 in this PR: https://github.com/Interkarma/daggerfall-unity/pull/2160/files#diff-19063ddd0d72895174af2f1e16dd67e9c31329b6c2b66995d076184724e2991dR550

Crucially, for TextureReplacement.GetMobileBillboardMaterial, we read textures in three points:

This issue therefore mostly hits mods like Daggerfall Enemy Expansion and Vanilla Enhanced and "DEX - DREAM patch", which provide textures for mobiles outside the classics. They generally don't need the mobile textures to be readable, but this new code path I added accidentally demanded it.

There is no reason for keeping this inconsistency, that was a mistake in my original PR from lack of understanding. There is no conceivable world where a mod relies on the mobile material being readable/writable only if it's a custom archive.

The fix is on line 628 and 634. The rest is either readability/documentation, or new overloads for mods to use.