void OnOutputEventRecieved(VFXOutputEventArgs args)
 {
     if (Application.isPlaying || (executeInEditor && canExecuteInEditor))
     {
         if (args.nameId == outputEvent)
         {
             OnVFXOutputEvent(args.eventAttribute);
         }
     }
 }
        void ProcessVisualEffectEvent(VFXOutputEventArgs eventArgs)
        {
            if (eventArgs.nameId != s_outputEventNameId)
            {
                Debug.LogErrorFormat("Incorrect output event name : {0} (expected:{1})", eventArgs.nameId, s_outputEventNameId);
            }

            //texIndex isn't used in particle system but it should be reachable in these vfx event attribute.
            var  texIndex = eventArgs.eventAttribute.GetFloat(s_texIndexId);
            bool correct  = false;

            foreach (var value in s_acceptableTexIndexValues)
            {
                if (Mathf.Abs(value - texIndex) < 1e-5f)
                {
                    correct = true;
                    break;
                }
            }

            if (!correct)
            {
                Debug.LogError("Unable to retrieve texIndex, got : " + texIndex);
                return;
            }

            var newObject = GameObject.Instantiate(m_ObjectReference);

            newObject.GetComponent <Transform>().position = eventArgs.eventAttribute.GetVector3(s_positionNameId);
            var renderer        = newObject.GetComponent <Renderer>();
            var currentMaterial = renderer.material;

            currentMaterial = new Material(currentMaterial);
            currentMaterial.SetVector(s_customEmissionNameId, eventArgs.eventAttribute.GetVector3(s_colorNameId));
            renderer.material = currentMaterial;
            newObject.SetActive(true);
        }