Skip to main content
added 10 characters in body
Source Link
Dayan
  • 101
  • 5

Unity 10182018.2.9f1, only 1 script, there is no other code. The scene is very simple (I just started).

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the GameObject'sTapEffect's GameObject X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }
    
    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Here is a screenshot of the TapEffect Particle, default particle.

enter image description here

This is a view of the Player GameObject selected.

enter image description here

Unity 1018.2.9f1, only 1 script, there is no other code. The scene is very simple (I just started).

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the GameObject's X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }
    
    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Here is a screenshot of the TapEffect Particle, default particle.

enter image description here

This is a view of the Player GameObject selected.

enter image description here

Unity 2018.2.9f1, only 1 script, there is no other code. The scene is very simple (I just started).

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the TapEffect's GameObject X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }
    
    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Here is a screenshot of the TapEffect Particle, default particle.

enter image description here

This is a view of the Player GameObject selected.

enter image description here

added 409 characters in body
Source Link
Dayan
  • 101
  • 5

Unity 1018.2.9f1, only 1 script, there is no other code. The scene is very simple (I just started).

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the GameObject's X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }
    
    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Here is a screenshot of the TapEffect Particle, default particle.

enter image description here

This is a view of the Player GameObject selected.

enter image description here

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the GameObject's X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }
    
    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Unity 1018.2.9f1, only 1 script, there is no other code. The scene is very simple (I just started).

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the GameObject's X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }
    
    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Here is a screenshot of the TapEffect Particle, default particle.

enter image description here

This is a view of the Player GameObject selected.

enter image description here

Source Link
Dayan
  • 101
  • 5

Changing transform of ParticleSystem makes it not play?

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the GameObject's X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }
    
    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}