Search Unity

Legacy and Shuriken Particle System find hidden properties name

Discussion in 'Editor & General Support' started by HubertGendron, Feb 22, 2013.

  1. HubertGendron

    HubertGendron

    Joined:
    Feb 22, 2013
    Posts:
    9
    Hey guys !

    So this is my first post on this forum but i'm working with unity for over 2 years now. So, i'm currently creating and editor script for both Legacy particle system and the new Shuriken particle system, basically what i need is to access each serialized properties of both particles system. For the legacy particle system it was the more easy because almost all properties are public, except for the Ellipsoid and Tangent Velocity property. Now i've been able to find the Ellipsoid variable name using :

    Code (csharp):
    1. SerializedObject so = new SerializedObject(myLegacyParticleScript);
    2. so.FindProperty("m_Ellipsoid")
    But I was not been able to find the name of the TangentVelocity serialized property name. So I was wondering if someone of Unity Team or anybody on this forum knows all serialized properties name of Lagacy Particle System and of the New Shiruken Particle System.

    Thanks for your help ! ;)
     
  2. HubertGendron

    HubertGendron

    Joined:
    Feb 22, 2013
    Posts:
    9
    Hey !

    Finally I found the solution by myself. I've written a script which output all the Properties (Variables) name of all components on selected object. Then I can easily access the property using my code above. If anyone needs it in the future this is my code :

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using UnityEditor;
    4. using System.Collections;
    5.  
    6. public class FindAllProperties : Editor
    7. {
    8.     [MenuItem("Window/Find All Object Properties ")]
    9.    
    10.     static void Init ()
    11.     {
    12.         Component[] allComponent;
    13.         allComponent = Selection.activeGameObject.GetComponents<Component>();
    14.        
    15.         foreach(Component go in allComponent)
    16.         {
    17.             SerializedObject m_Object = new SerializedObject(go);
    18.             Debug.Log ("--------"+ go.GetType() +"-------");
    19.             try
    20.             {
    21.                 SerializedProperty obj = m_Object.GetIterator();
    22.                
    23.                 foreach(SerializedProperty property in obj)
    24.                 {
    25.                     Debug.Log(property.name + " : " + property.propertyType);
    26.                 }
    27.             }
    28.             catch(System.Exception e)
    29.             {
    30.                
    31.             }
    32.         }
    33.     }
    34. }
    35.  
    P.S. Need to be put in Editor folder.

    Thanks.
     
  3. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Thanks for sharing!
     
  4. feyyd

    feyyd

    Joined:
    Apr 23, 2014
    Posts:
    10
    Since it seems to be undocumented everywhere, I went ahead and made a nicely formatted list that contains all property names separated by module, with corresponding type
    Code (csharp):
    1.  
    2.      Shuriken Property Names
    3.    
    4.      Anything marked Generic type can have these params
    5.      Generic:
    6.         scalar : Float
    7.         maxCurve : AnimationCurve
    8.         minCurve : AnimationCurve
    9.         minMaxState : Integer
    10.    
    11.    
    12.      Base properties (no prefix, "m_LocalRotation")
    13.         m_LocalRotation : Quaternion
    14.         m_LocalPosition : Vector3
    15.         m_LocalScale : Vector3
    16.         lengthInSec : Float
    17.         startDelay : Float
    18.         speed : Float
    19.         randomSeed : Integer
    20.         looping : Boolean
    21.         prewarm : Boolean
    22.         playOnAwake : Boolean
    23.         moveWithTransform : Boolean
    24.  
    25.     Submodules accessed via SubmoduleName.propertyName (ie InitialModule.startLifetime)
    26.     InitialModule
    27.         enabled : Boolean
    28.         startLifetime : Generic
    29.         startSpeed : Generic
    30.         startColor : Generic
    31.         minMaxState : Integer
    32.         startSize : Generic
    33.         startRotation : Generic
    34.         gravityModifier : Float
    35.         inheritVelocity : Float
    36.         maxNumParticles : Integer
    37.  
    38.     ShapeModule
    39.         enabled : Boolean
    40.         type : Integer
    41.         radius : Float
    42.         angle : Float
    43.         length : Float
    44.         boxX : Float
    45.         boxY : Float
    46.         boxZ : Float
    47.         placementMode : Integer
    48.         m_Mesh : ObjectReference
    49.         randomDirection : Boolean
    50.  
    51.     EmissionModule
    52.         enabled : Boolean
    53.         m_Type : Integer
    54.         rate : Generic
    55.         cnt0 : Integer
    56.         cnt1 : Integer
    57.         cnt2 : Integer
    58.         cnt3 : Integer
    59.         time0 : Float
    60.         time1 : Float
    61.         time2 : Float
    62.         time3 : Float
    63.         m_BurstCount : Integer
    64.  
    65.     SizeModule
    66.         enabled : Boolean
    67.         curve : Generic
    68.  
    69.     RotationModule
    70.         enabled : Boolean
    71.         curve : Generic
    72.  
    73.     ColorModule
    74.         enabled : Boolean
    75.         gradient : Generic
    76.         maxGradient : Gradient
    77.         minGradient : Gradient
    78.         minColor : Color
    79.         maxColor : Color
    80.         minMaxState : Integer
    81.  
    82.     UVModule
    83.         enabled : Boolean
    84.         frameOverTime : Generic
    85.         tilesX : Integer
    86.         tilesY : Integer
    87.         animationType : Integer
    88.         rowIndex : Integer
    89.         cycles : Float
    90.         randomRow : Boolean
    91.  
    92.     VelocityModule
    93.         enabled : Boolean
    94.         x : Generic
    95.         y : Generic
    96.         z : Generic
    97.         inWorldSpace : Boolean
    98.  
    99.     ForceModule
    100.         enabled : Boolean
    101.         x : Generic
    102.         y : Generic
    103.         z : Generic
    104.         inWorldSpace : Boolean
    105.         randomizePerFrame : Boolean
    106.  
    107.     ExternalForcesModule
    108.         enabled : Boolean
    109.         multiplier : Float
    110.         ClampVelocityModule : Generic
    111.         enabled : Boolean
    112.         x : Generic
    113.         y : Generic
    114.         z : Generic
    115.         magnitude : Generic
    116.         separateAxis : Boolean
    117.         inWorldSpace : Boolean
    118.         dampen : Float
    119.  
    120.     SizeBySpeedModule
    121.         enabled : Boolean
    122.         curve : Generic
    123.         range : Vector2
    124.  
    125.     RotationBySpeedModule
    126.         enabled : Boolean
    127.         curve : Generic
    128.         range : Vector2
    129.  
    130.     ColorBySpeedModule
    131.         enabled : Boolean
    132.         gradient : Generic
    133.         maxGradient : Gradient
    134.         minGradient : Gradient
    135.         minColor : Color
    136.         maxColor : Color
    137.         minMaxState : Integer
    138.         range : Vector2
    139.  
    140.     CollisionModule
    141.         enabled : Boolean
    142.         type : Integer
    143.         plane0 : ObjectReference
    144.         plane1 : ObjectReference
    145.         plane2 : ObjectReference
    146.         plane3 : ObjectReference
    147.         plane4 : ObjectReference
    148.         plane5 : ObjectReference
    149.         dampen : Float
    150.         bounce : Float
    151.         energyLossOnCollision : Float
    152.         minKillSpeed : Float
    153.         particleRadius : Float
    154.         collidesWith : LayerMask
    155.         quality : Integer
    156.         voxelSize : Float
    157.         collisionMessages : Boolean
    158.  
    159.     SubModule
    160.         enabled : Boolean
    161.         subEmitterBirth : ObjectReference
    162.         subEmitterBirth1 : ObjectReference
    163.         subEmitterCollision : ObjectReference
    164.         subEmitterCollision1 : ObjectReference
    165.         subEmitterDeath : ObjectReference
    166.         subEmitterDeath1 : ObjectReference
    167.         m_CastShadows : Boolean
    168.         m_ReceiveShadows : Boolean
    169.         m_Materials : Generic
    170.         size : ArraySize
    171.         data : ObjectReference
    172.         m_UseLightProbes : Boolean
    173.         m_LightProbeAnchor : ObjectReference
    174.         m_RenderMode : Integer
    175.         m_MaxParticleSize : Float
    176.         m_CameraVelocityScale : Float
    177.         m_VelocityScale : Float
    178.         m_LengthScale : Float
    179.         m_SortingFudge : Float
    180.         m_NormalDirection : Float
    181.         m_SortMode : Integer
    182.         m_Mesh : ObjectReference
    183.         m_Mesh1 : ObjectReference
    184.         m_Mesh2 : ObjectReference
    185.         m_Mesh3 : ObjectReference
    186.         m_Avatar : ObjectReference
    187.         m_Controller : ObjectReference
    188.         m_CullingMode : Enum
    189.         m_UpdateMode : Enum
    190.         m_ApplyRootMotion : Boolean
    191.         m_HasTransformHierarchy : Boolean
    192.         m_AllowConstantClipSamplingOptimization : Boolean
    193.  
     
  5. whaison

    whaison

    Joined:
    Dec 12, 2014
    Posts:
    2
    Thanks but.....
    I Want to Chenge The particle system hidden properties value

    But Can not Chenge.

    Code (CSharp):
    1. using UnityEngine;
    2. using UnityEditor;
    3. using System.Collections;
    4.  
    5. public class FindAllProperties : Editor
    6. {
    7.     [MenuItem("Assets/Find All Object Properties ")]
    8.  
    9.     static void Init ()
    10.     {
    11.         Component[] allComponent;
    12.         allComponent = Selection.activeGameObject.GetComponents<Component>();
    13.  
    14.         bool bool_UVModule=false;
    15.         bool bool_frameOverTime=false;
    16.         foreach(Component go in allComponent)
    17.         {
    18.             SerializedObject m_Object = new SerializedObject(go);
    19.             Debug.Log ("--------"+ go.GetType() +"-------");
    20.             try
    21.             {
    22.                 SerializedProperty obj = m_Object.GetIterator();
    23.  
    24.                 foreach(SerializedProperty property in obj)
    25.                 {
    26.                     Debug.Log(property.name + " : " + property.propertyType);
    27.                     if(property.name=="UVModule"){
    28.                         Debug.Log("//#######UVModule #############");
    29.                         bool_UVModule=true;
    30.                     }
    31.                     if(bool_UVModule==true){
    32.                         if(property.name=="enabled"){
    33.                             property.boolValue=true;;
    34.                         }
    35.                         if(property.name=="frameOverTime"){
    36.                             bool_frameOverTime=true;
    37.                         }
    38.                         if(property.name=="scalar"){
    39.                             property.floatValue=0.0f;
    40.                             bool_frameOverTime=false;
    41.                         }
    42.                         if(property.name=="tilesX"){
    43.                             property.intValue=2;
    44.  
    45.                         }
    46.                         if(property.name=="tilesY"){
    47.                             property.intValue=2;
    48.                         }
    49.  
    50.                         if(property.name=="animationType"){
    51.                             property.intValue=0;//whole sheet
    52.                         }
    53.  
    54.                         if(property.name=="UVModule"){}
    55.                     }
    56.                     if(property.name=="VelocityModule"){
    57.                         Debug.Log("//#######VelocityModule#############");
    58.                         bool_UVModule=false;
    59.                     }
    60.  
    61.                 }
    62.             }
    63.             catch(System.Exception e)
    64.             {
    65.  
    66.             }
    67.         }
    68.     }
    69. }

    UVModule is "Texture Sheet Animation"

    but un chenge this.

    screen2015-07-26 1.19.07.png
     
  6. whaison

    whaison

    Joined:
    Dec 12, 2014
    Posts:
    2
  7. dreamerflyer

    dreamerflyer

    Joined:
    Jun 11, 2011
    Posts:
    927
    how to Deserialized this in runtime?