I am currently trying to conrol the dissolve speed on the shader through an activated script on the same object, but i cannot seem to alter the code so that it does not loop: Code (csharp): using UnityEngine; using System.Collections; public class Timed : MonoBehaviour { public float m_fDestruktionSpeed = 0.1f; public Material m_Mat; public float m_fTime; void Start () { m_Mat = renderer.material; } void Update () { m_fTime += Time.deltaTime * m_fDestruktionSpeed; if (m_fTime >= 1.5f) m_fTime = 0; m_Mat.SetFloat("_Amount", m_fTime); } } How can i alter this to make it just dissolve one time when i activate the component. Thank you
Why don't you just use a bool variable? You set a conditional for this bool to be true, when you are done you just set it to false and it wont run anymore.
Yea I just bought this, and that script came with it. Unfortunately I don't code. I use Playmaker. So how would a simple script that affects the _Amount on the shader over time look? Thank you for your help.
change line 16 from if (m_fTime >= 1.5f) to if (m_fTime < 1.5f) and remove line 17 Should do the trick, hope this helps!