Custom Inspector for Particle System

Im making a custom inspector for the particle system, I have a slider which alters the emission rate. I have 2 problems:

  1. The particle system is no longer rendered in scene view.

  2. The slider immediately reverts. If I play the game I can use the slider to change the emission but the slider dosn’t move (or returns next frame). The same is true for the floatField.

    using UnityEngine;
    using System.Collections;
    using UnityEditor;

    public class ParticleCustomizer : Editor {
    private ParticleSystem ps;

    public override void OnInspectorGUI() {
        ps = (ParticleSystem)target;
        ps.emissionRate = EditorGUILayout.Slider("Emission:", 50, 0, 100);        


The second problem is you should set the slider value to ps.emissionRate, like this:

ps.emissionRate = EditorGUILayout.Slider("Emission:", ps.emissionRate, 0, 100);

But the thing is, you shouldn’t overwrite the particle system’s default editor inspector. This inspector allows you simulating in edit time and many other things that you shouldn’t overwrite.

Ah, of course. ^^
As for overwriting, I want to add functionality to the editor like randomization, don’t I then have to overwrite?