@DanH said in Issue with changing SliderPack amount having saved presets previously...:
I'm guessing that the slider amount is saved within the preset data.
Yup, it stores the slider data as float array so if the length isn't the same, it will resize the sliders.
You can solve this like any other issue related to backwards-compatibilty of presets: assign a preload-callback to the user preset handler where you preprocess the data and add the missing slider.
Add a SliderPack
Create two presets with different amount of sliders (one should be 16, the other one some smaller number for this example)
Use this script:
const var SliderPack1 = Content.getComponent("SliderPack1");
const var uph = Engine.createUserPresetHandler();
uph.setEnableUserPresetPreprocessing(true, // enable preprocessing
true); // unpack complex data (so the slider pack data is available as array)
uph.setPreCallback(function(presetData)
{
// You can check the preset version against the current project version
// to avoid preprocessing if the presets are up to date
// (this saves a bit of time but isn't 100% necessary...)
var oldVersion = uph.isOldVersion(presetData.version);
//if(!oldVersion)
// return;
for(d in presetData.Content)
{
if(d.id == "SliderPack1")
{
while(d.data.length < 16)
d.data.push(Math.random()); // fill it up with random values so you see the effect
}
}
});