protected override void OnUpdate() { var toBeDestroyedEntities = m_DestroyGroup.GetEntityArraySt(); for (int i = 0; i < toBeDestroyedEntities.Length; ++i) { var toBeDestroyedEntity = toBeDestroyedEntities[i]; var tr = EntityManager.GetComponentObject <UnityEngine.Transform>(toBeDestroyedEntity); if (tr != null) { if (vfxGo == null) { vfxGo = new UnityEngine.GameObject("VfxGameObject"); vfx = vfxGo.AddComponent <UnityEngine.Experimental.VFX.VisualEffect>(); var grenadeClient = tr.GetComponent <GrenadeClient>(); vfx.visualEffectAsset = grenadeClient.explodeEffect.effect; vfxEventAttribute = vfx.CreateVFXEventAttribute(); } vfxEventAttribute.SetVector3(positionID, tr.position); vfx.Play(vfxEventAttribute); UnityEngine.Object.Destroy(tr.gameObject); } } }
private void Awake() { rigidBody = GetComponent <Rigidbody>(); grabScript = player.GetComponent <GrabObjects>(); forceParticles = GetComponentInChildren <UnityEngine.Experimental.VFX.VisualEffect>(); forceParticles.SetFloat("Input", 0.0f); }
void Start() { mainCamera = GameObject.Find("MainCamera"); vfx = this.GetComponent <UnityEngine.Experimental.VFX.VisualEffect>(); dataFileName = Application.dataPath + "/Data/" + fileName; colormapWidth = colormap.width; StartCoroutine(LoadingBar()); StartCoroutine(RunOffMainThread()); }