protected override void ReadFromImpl(object obj) { base.ReadFromImpl(obj); ParticleSystem.TrailModule uo = (ParticleSystem.TrailModule)obj; enabled = uo.enabled; mode = uo.mode; ratio = uo.ratio; lifetime = uo.lifetime; lifetimeMultiplier = uo.lifetimeMultiplier; minVertexDistance = uo.minVertexDistance; textureMode = uo.textureMode; worldSpace = uo.worldSpace; dieWithParticles = uo.dieWithParticles; sizeAffectsWidth = uo.sizeAffectsWidth; sizeAffectsLifetime = uo.sizeAffectsLifetime; inheritParticleColor = uo.inheritParticleColor; colorOverLifetime = uo.colorOverLifetime; widthOverTrail = uo.widthOverTrail; widthOverTrailMultiplier = uo.widthOverTrailMultiplier; colorOverTrail = uo.colorOverTrail; generateLightingData = uo.generateLightingData; ribbonCount = uo.ribbonCount; shadowBias = uo.shadowBias; splitSubEmitterRibbons = uo.splitSubEmitterRibbons; attachRibbonsToTransform = uo.attachRibbonsToTransform; }
override public void OnInspectorGUI(InitialModuleUI initial) { ParticleSystemTrailMode mode = (ParticleSystemTrailMode)GUIPopup(s_Texts.mode, m_Mode, s_Texts.trailModeOptions); if (!m_Mode.hasMultipleDifferentValues) { if (mode == ParticleSystemTrailMode.PerParticle) { GUIFloat(s_Texts.ratio, m_Ratio); GUIMinMaxCurve(s_Texts.lifetime, m_Lifetime); GUIFloat(s_Texts.minVertexDistance, m_MinVertexDistance); GUIToggle(s_Texts.worldSpace, m_WorldSpace); GUIToggle(s_Texts.dieWithParticles, m_DieWithParticles); } else { GUIInt(s_Texts.ribbonCount, m_RibbonCount); GUIToggle(s_Texts.splitSubEmitterRibbons, m_SplitSubEmitterRibbons); GUIToggle(s_Texts.attachRibbonsToTransform, m_AttachRibbonsToTransform); } } GUIPopup(s_Texts.textureMode, m_TextureMode, s_Texts.textureModeOptions); GUIVector2Field(s_Texts.textureScale, m_TextureScale); GUIToggle(s_Texts.sizeAffectsWidth, m_SizeAffectsWidth); if (!m_Mode.hasMultipleDifferentValues) { if (mode == ParticleSystemTrailMode.PerParticle) { GUIToggle(s_Texts.sizeAffectsLifetime, m_SizeAffectsLifetime); } } GUIToggle(s_Texts.inheritParticleColor, m_InheritParticleColor); GUIMinMaxGradient(s_Texts.colorOverLifetime, m_ColorOverLifetime, false); GUIMinMaxCurve(s_Texts.widthOverTrail, m_WidthOverTrail); GUIMinMaxGradient(s_Texts.colorOverTrail, m_ColorOverTrail, false); GUIToggle(s_Texts.generateLightingData, m_GenerateLightingData); GUIFloat(s_Texts.shadowBias, m_ShadowBias); // Add a warning message when no trail material is assigned, telling users where to find it foreach (ParticleSystem ps in m_ParticleSystemUI.m_ParticleSystems) { if (ps.trails.enabled) { ParticleSystemRenderer renderer = ps.GetComponent <ParticleSystemRenderer>(); if ((renderer != null) && (renderer.trailMaterial == null)) { EditorGUILayout.HelpBox("Assign a Trail Material in the Renderer Module", MessageType.Warning, true); break; } } } }
public override void OnInspectorGUI(InitialModuleUI initial) { ParticleSystemTrailMode particleSystemTrailMode = (ParticleSystemTrailMode)ModuleUI.GUIPopup(TrailModuleUI.s_Texts.mode, this.m_Mode, TrailModuleUI.s_Texts.trailModeOptions, new GUILayoutOption[0]); if (!this.m_Mode.hasMultipleDifferentValues) { if (particleSystemTrailMode == ParticleSystemTrailMode.PerParticle) { ModuleUI.GUIFloat(TrailModuleUI.s_Texts.ratio, this.m_Ratio, new GUILayoutOption[0]); ModuleUI.GUIMinMaxCurve(TrailModuleUI.s_Texts.lifetime, this.m_Lifetime, new GUILayoutOption[0]); ModuleUI.GUIFloat(TrailModuleUI.s_Texts.minVertexDistance, this.m_MinVertexDistance, new GUILayoutOption[0]); ModuleUI.GUIToggle(TrailModuleUI.s_Texts.worldSpace, this.m_WorldSpace, new GUILayoutOption[0]); ModuleUI.GUIToggle(TrailModuleUI.s_Texts.dieWithParticles, this.m_DieWithParticles, new GUILayoutOption[0]); } else { ModuleUI.GUIInt(TrailModuleUI.s_Texts.ribbonCount, this.m_RibbonCount, new GUILayoutOption[0]); ModuleUI.GUIToggle(TrailModuleUI.s_Texts.splitSubEmitterRibbons, this.m_SplitSubEmitterRibbons, new GUILayoutOption[0]); } } ModuleUI.GUIPopup(TrailModuleUI.s_Texts.textureMode, this.m_TextureMode, TrailModuleUI.s_Texts.textureModeOptions, new GUILayoutOption[0]); ModuleUI.GUIToggle(TrailModuleUI.s_Texts.sizeAffectsWidth, this.m_SizeAffectsWidth, new GUILayoutOption[0]); if (!this.m_Mode.hasMultipleDifferentValues) { if (particleSystemTrailMode == ParticleSystemTrailMode.PerParticle) { ModuleUI.GUIToggle(TrailModuleUI.s_Texts.sizeAffectsLifetime, this.m_SizeAffectsLifetime, new GUILayoutOption[0]); } } ModuleUI.GUIToggle(TrailModuleUI.s_Texts.inheritParticleColor, this.m_InheritParticleColor, new GUILayoutOption[0]); base.GUIMinMaxGradient(TrailModuleUI.s_Texts.colorOverLifetime, this.m_ColorOverLifetime, false, new GUILayoutOption[0]); ModuleUI.GUIMinMaxCurve(TrailModuleUI.s_Texts.widthOverTrail, this.m_WidthOverTrail, new GUILayoutOption[0]); base.GUIMinMaxGradient(TrailModuleUI.s_Texts.colorOverTrail, this.m_ColorOverTrail, false, new GUILayoutOption[0]); ModuleUI.GUIToggle(TrailModuleUI.s_Texts.generateLightingData, this.m_GenerateLightingData, new GUILayoutOption[0]); ParticleSystem[] particleSystems = this.m_ParticleSystemUI.m_ParticleSystems; for (int i = 0; i < particleSystems.Length; i++) { ParticleSystem particleSystem = particleSystems[i]; if (particleSystem.trails.enabled) { ParticleSystemRenderer component = particleSystem.GetComponent <ParticleSystemRenderer>(); if (component != null && component.trailMaterial == null) { EditorGUILayout.HelpBox("Assign a Trail Material in the Renderer Module", MessageType.Warning, true); break; } } } }