Author Topic: Unity 2.5.2 plugin issues  (Read 191 times)

Hi there,

I'm having several issues with 2.5.2.
Unfortunately I can't tell you at what point these issues occurred only that they are in 2.5.2 while running Unity 2020.1.1 f1

The first problem is that none of my output textures get assigned to the material / shader input slots. I have 2 outputs from my substance, diffuse and normal. I can assign the correct output textures to the correct shader input slots in the editor, but the moment I click away from the material it resets to no texture assignments. This used to work when I first tried the plugin implementation in Unity 2018 a few months back.

Next issue, all procedural material instances no longer allow me to see the material properties at runtime. It just says 'No Shader Selected".

Finally 2.5.2's release notes mention the inclusion of the "IsProcessing" function. I cannot find said function anywhere in the  documentation or the visual studio autocomplete fields. So I'm not actually sure if it's really there, or if it is, where it has been moved to. Presumably it should still be a bool that return true until the substance has finished running changes?

Any help most welcome.
Last Edit: August 12, 2020, 01:28:44 pm

hey @andy.dys are you using a substance from Substance source? if yes, which one? This should work with 2020 and 2.5.2.
The code to use IsProcessing() function is something like this:
using UnityEngine;
using Substance.Game;
using UnityEngine.UI;

public class Testing : MonoBehaviour
{
    // USE: ceramic_porcelain_cracked.sbsar
    public Substance.Game.SubstanceGraph graph; // MUST BE ASSIGNED BY THE USER (in the GameObject's script section)

    static int c = 1; // fraction of a color's scale
    static int dc = 1; // step of a color's scale (from 0 to 10)
    static Color color;

    void Start()
    {
        UpdateColor();
    }

    void Update()
    {
        if (Substance.Game.Substance.IsProcessing())
        {
            Debug.Log("BUSY!");
            return;
        }

        Debug.Log("Changing color...");
        UpdateColor();
    }

    void UpdateColor()
    {
        // ...............................................
        if (c >= 10)
            dc = -1;
        else if (c <= 0)
            dc = 1;
        c += dc;

        // -----------------------------------------------------
        color = new Color(0.1f, c / 10.0f, 0.1f, 1.0f);
        graph.SetInputColor("porcelain_color", color);

        graph.QueueForRender();
        Substance.Game.Substance.RenderSubstancesAsync();
    }
}