# getComponent ParticleSystem (shuriken)

**URL:** https://discussions.unity.com/t/getcomponent-particlesystem-shuriken/468942
**Category:** Scripting
**Tags:** Scripting
**Created:** [February 22, 2012, 5:26pm UTC](https://discussions.unity.com/t/getcomponent-particlesystem-shuriken/468942 "2012-02-22T17:26:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![anon\_9931887](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@anon\_9931887](https://discussions.unity.com/u/anon_9931887)
#### Post date: [February 22, 2012, 5:26pm UTC](https://discussions.unity.com/t/getcomponent-particlesystem-shuriken/468942/1 "2012-02-22T17:26:38Z")

</div>

I may be missing something obvious, but last night i couldn’t figure out how to gain access to ParticleSystem attached to some object.

i have two objects: xform1 and xform2  
xform1 has a script attached  
xform2 has a ParticleSystem (shuriken) attached  
i want to be able to trigger particle emission from the xform1’s script when some button is pressed.  
The problem is that i cannot figure out how to access the ParticleSystem on the other object - xform2  
Tried so many things (getComponent variations) but always get null pointers.

Can somebody provide an example how to gain access to a ParticleSystem located on an object from script attached to another object ?

Thanks.

---

<div class="post-metadata">

### Author: ![KelsoMRK](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kelsomrk/32/205687_2.png) [@KelsoMRK](https://discussions.unity.com/u/KelsoMRK)
#### Post date: [February 22, 2012, 5:37pm UTC](https://discussions.unity.com/t/getcomponent-particlesystem-shuriken/468942/2 "2012-02-22T17:37:07Z")

</div>

Were you using getComponent or GetComponent?

---

<div class="post-metadata">

### Author: ![anon\_9931887](https://avatars.discourse-cdn.com/v4/letter/a/ba9def/32.png) [@anon\_9931887](https://discussions.unity.com/u/anon_9931887)
#### Post date: [February 22, 2012, 6:05pm UTC](https://discussions.unity.com/t/getcomponent-particlesystem-shuriken/468942/3 "2012-02-22T18:05:01Z")

</div>

> [@KelsoMRK](#):
>
> Were you using getComponent or GetComponent?

I use gameObject.GetComponent.

var go : GameObject;  
private var ps : ParticleSystem;

ps = go.GetComponent(ParticleSystem);  
ps = go.GetComponent(“MyParticleSystem”);  
etc …

I don’t get syntax errors. Just not getting the data properly.

Also the component class has particleSystem attribute that should give me the particle system attached to the game object. But not sure how to make use of that too.

This is my second day in Unity and i really like what i see there.  
Got some ships flying around shooting at each other, etc.  
Started refining some things and hit that ParticleSystem problem.  
Found some examples online but they are all about the “old” particles.

Thanks.
