Unity Community


Results 1 to 7 of 7

  1. Posts
    1,939

    How to play a shuriken particle system?

    I have this code here. With the old particle system i had no problem to play it with the old keywords ParticleEmitter instead ParticleSystem and emit instead play.

    Code:  
    1. var myparticlesystem: ParticleSystem;
    2. var test:boolean=false;
    3.  
    4. function OnCollisionEnter(other: Collision){
    5.         test=true;
    6.         myparticlesystem.play=true;
    7. }

    The particle system is in the variable slot. Test goes to true with a collision. The collision triggers. But the particle system does not play. I get an error instead:

    Code:  
    1. MissingFieldException: Field 'UnityEngine.ParticleSystem.play' not found.

    The reference says that i have to use Play though (by the way, why is the first letter big here? Shouldn`t it be a small letter?)

    http://unity3d.com/support/documenta...stem.Play.html

    What is wrong here?
    Free Game Graphics, Freeware Games http://www.reinerstilesets.de
    Die deutsche 3D Community: http://www.3d-ring.de


  2. Posts
    2,871
    Play is a method, not a property or a field.

    Code:  
    1. myparticlesystem.Play();


  3. Posts
    1,939
    Ah, no wonder. So the method has changed too, not just the keywords. Many thanks Dantus

    I wish this would be mentioned in the manual too ...
    Free Game Graphics, Freeware Games http://www.reinerstilesets.de
    Die deutsche 3D Community: http://www.3d-ring.de


  4. Location
    Germany
    Posts
    1,215
    Typical case of RTFM: Particle System. The docs already describes all of the methods the class has.

    Edit:
    P.S.

    ParticleAnimator, ParticleEmiter and ParticleRenderer are part of the legacy (old) Particle system.

    ParticleSystem, ParticleSystem.Particle and ParticleSystemRenderer are the new Shuriken Particle classes
    Last edited by Tseng; 06-27-2012 at 06:13 AM.
    C# Developer
    www.Atomic-Gear.net
    Games:
    The Pirate Game: Android Market Link


  5. Posts
    1,939
    Typical case of RTFM
    This was and is always my first way. But this didn`t help me, as usual. I nearly always end in the forum when i have a look at the reference. Because it is more a dictionary. And doesn`t really help with the useage in most cases.

    I was in need of Dantus`s code snippet to understand what is meant. And then i understood it very quick. So again thanks Dantus.
    Free Game Graphics, Freeware Games http://www.reinerstilesets.de
    Die deutsche 3D Community: http://www.3d-ring.de


  6. Posts
    2,871
    You can see it in the documentation that you are dealing with a function (method). The line just below the title is:

    function Play (withChildren : boolean = true) : void
    I struggle with this kind of things too if I have to implement something in UnityScript, as it doesn't (or maybe didn't?) have such good autocompletion as C#.

    @Tseng: You can not tell someone RTFM, if he even posted a link to it .


  7. Posts
    1,939
    You can see it in the documentation that you are dealing with a function (method). The line just below the title is:
    Yes, but i didn`t realize it until i saw your code snippet. I was too focused at the old method with the flag. My brain refused to accept what it has read. Maybe i should have a look for a new brain. Do you have one left?
    Free Game Graphics, Freeware Games http://www.reinerstilesets.de
    Die deutsche 3D Community: http://www.3d-ring.de

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •