Simul Support ExchangeCategory: External Plugin IssuesUnity, changing values during runtime.
Marko Barthel asked 1 year ago

I’m having trouble to change trueSKY (version 4.3) values during runtime. The “old” code from version 4.1a does not work anymore. And I tried also the KeyframeTesting.cs script, but it does not find any cloud keyframes in the sequence.This is the old working code from version 4.1a.

if(tS != null) {
    int numj = tS.GetNumCloudKeyframes();
    for(int i = 0; i < numj; i++) {
        uint uid = tS.GetCloudKeyframeByIndex(i);
        tS.SetKeyframeValue(uid, "cloudiness", Cloudiness = Mathf.Lerp(0f, 1f, sliderCloudiness.value));

Andrew Richards Staff replied 12 months ago

Hi Marko,

Thank you for your question.
trueSKY has moved away from the use of indices in favour of UIDs.
I have spoken with the team and we need to address the function naming convention in Unity.
Please amend your code as follows:

if (tS != null)
int cl_uid = (int)GetCloudLayerUIDByIndex(0);
int kf_num = tS.GetNumCloudKeyframes(cl_uid);
for (int i = 0; i < kf_num; i++)
uint kf_uid = StaticRenderGetKeyframeByIndex(cl_uid, i);
tS.SetKeyframeValue(kf_uid, "cloudiness", 0.5f);

Please be aware of this new class that interfaces with the DLL: TrueSkyPluginRenderFunctionImporter

Please let me know if you require any further assistance.
Best Wishes,

Marko Barthel replied 12 months ago

Thank you for the quick response Andrew. Tomorrow I’m back at work and I can try these changes to the code.