public void OnEnable() { trails = target as PlaygroundTrails; s_trails = new SerializedObject(trails); s_time = s_trails.FindProperty("time"); s_material = s_trails.FindProperty("material"); s_lifetimeColor = s_trails.FindProperty("lifetimeColor"); s_colorMode = s_trails.FindProperty("colorMode"); s_uvMode = s_trails.FindProperty("uvMode"); s_pointArrayAlpha = s_trails.FindProperty("pointArrayAlpha"); s_renderMode = s_trails.FindProperty("renderMode"); s_billboardTransform = s_trails.FindProperty("billboardTransform"); s_customRenderScale = s_trails.FindProperty("customRenderScale"); s_timeWidth = s_trails.FindProperty("timeWidth"); s_widthScale = s_trails.FindProperty("widthScale"); s_minVertexDistance = s_trails.FindProperty("minVertexDistance"); s_maxVertexDistance = s_trails.FindProperty("maxVertexDistance"); s_maxPathDeviation = s_trails.FindProperty("maxPathDeviation"); s_createPointsOnCollision = s_trails.FindProperty("createPointsOnCollision"); s_maxPoints = s_trails.FindProperty("maxPoints"); s_createFirstPointOnParticleBirth = s_trails.FindProperty("createFirstPointOnParticleBirth"); s_createLastPointOnParticleDeath = s_trails.FindProperty("createLastPointOnParticleDeath"); s_playgroundSystem = s_trails.FindProperty("playgroundSystem"); s_multithreading = s_trails.FindProperty("multithreading"); s_receiveShadows = s_trails.FindProperty("receiveShadows"); #if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 s_castShadows = s_trails.FindProperty("castShadows"); #else s_castShadows = s_trails.FindProperty("shadowCastingMode"); #endif s_layer = s_trails.FindProperty("layer"); s_trails.Update(); if (s_layer.intValue < 0) { s_layer.intValue = trails.playgroundSystem.gameObject.layer; } s_layer.intValue = Mathf.Clamp(s_layer.intValue, 0, 32); #if UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_5_0 || UNITY_5_1 || UNITY_5_2 s_trails.ApplyModifiedProperties(); #else s_trails.ApplyModifiedPropertiesWithoutUndo(); #endif playgroundSettings = PlaygroundSettingsC.GetReference(); playgroundLanguage = PlaygroundSettingsC.GetLanguage(); // Issue a quick refresh if (!EditorApplication.isPlaying && Selection.activeTransform != null) { trails.ResetTrails(); } }
//private ParticleSystem.MainModule _mainModule; // Use this for initialization void Start() { this._particleSystem = GetComponent <PlaygroundParticlesC>(); this._particleSystem.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); this.trailScript = GetComponent <PlaygroundTrails>() as PlaygroundTrails; this._particleSystem.emit = false; this._active = false; this._scatterSize = 0.2f; this._particleScale = 0.2f; this.Scale(_scatterSize); this._gradient = new Gradient(); this._gradient.SetKeys(_gradient.colorKeys, _alphaKeys); InvokeRepeating("Shrink", 0.0f, 0.01f); InvokeRepeating("FadeToGray", 0.0f, 0.1f); }