title: Unity Particle system: Change Emitter Velocity with Script
body: <p>I have a particle system connected with an object that it follows. The Emitter Velocity is here set on Rigidbody. What I want is to have the particle system follow the object, as it does, but when detecting a touch input the particles are to follow the touch input, changing the Emitter Velocity to Transform. When running the code that I attached, there are two compiler errors that I have tried and failed to fix. Would appreciate someone taking a look at it.</p>
  
  <ul>
  <li>The 'Particle System' does not contain a definition for
  'emitterVelocity' and no accessible extension method
  'emitterVelocity' accepting a first argument of type 'ParticleSystem'
  could be found. line 28. </li>
  <li>'Transform' is a type, which is not valid in the given context.
  line 28.</li>
  </ul>
  
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class DragFingerMove : MonoBehaviour
  {
      private Vector3 touchPosition;
      private ParticleSystem ps;
      private Vector3 direction;
      private float moveSpeed = 10f;
  
      // Use this for initialization
      private void Start()
      {
          ps = GetComponent&lt;ParticleSystem&gt;();
      }
  
      // Update is called once per frame
      private void Update()
      {
          if (Input.touchCount &gt; 0)
          {
              Touch touch = Input.GetTouch(0);
              touchPosition = Camera.main.ScreenToWorldPoint(touch.position);
              touchPosition.z = 0;
              direction = (touchPosition - transform.position);
              ps.emitterVelocity = Transform;
              ps.velocity = new Vector2(direction.x, direction.y) * moveSpeed;
  
              if (touch.phase == TouchPhase.Ended)
                  ps.velocity = Vector2.zero;
          }
      }
  }
  </code></pre>