Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Moving Particle Systems

Discussion in 'Scripting' started by Tom13720, Apr 16, 2015.

  1. Tom13720

    Tom13720

    Joined:
    Apr 16, 2015
    Posts:
    6
    So Ive tried to make a simple script of moving a Particle system when I walk through another block somewhere else, but for some reason its not working. This is the code I have so far:
    Code (JavaScript):
    1. var parti : GameObject;
    2.  
    3. function OnTriggerEnter(other : Collider){
    4.     if(other.tag == "Player"){ //when player walks into box
    5.         parti.position = Vector3(-16.59,11.71,28);
    6.     }
    7. }
    If anyone can help me with this it would be greatly appreciated!
     
  2. Juice-Tin

    Juice-Tin

    Joined:
    Jul 22, 2012
    Posts:
    233
    Code (CSharp):
    1. parti.transform.position
    If you notice in the inspector, the position/scale/rotation are in the 'transform' component, so you have to access em through there.
     
  3. Tom13720

    Tom13720

    Joined:
    Apr 16, 2015
    Posts:
    6
    THANK YOU!!!!
    I knew it would be something silly like that xD