OndrejNepozitek / Edgar-Unity

Unity Procedural Level Generator
https://ondrejnepozitek.github.io/Edgar-Unity/docs/introduction
MIT License
817 stars 70 forks source link

Add a bool for disabling all post processing logic without having to manually remove all of them #89

Closed longtran2904 closed 3 years ago

longtran2904 commented 3 years ago

Sometimes when I want to test something without having any exception I have to manually remove all the post-processing and then reassign it later. So I think you should add a toggle to automate this process.

r2d2m commented 3 years ago

May I propose an improvement ?

May be a checkbox for each post-process ?

I'll try to find some time to look into it.

OndrejNepozitek commented 3 years ago

I was thinking about adding a checkbox into the "Advanced" section of the inspector that would disable all custom post-processing tasks. It'd be good to make it possible to disable individual tasks but that might be rather difficult due to how are tasks rendered inside the reorderable list - it's quite hard to customize that.

Also, there's a very simple solution that you can implement yourself for your own post-processing tasks. If you add a "public bool Enabled" field to your tasks, you can then do something like this inside the Run method of the task:

    public override void Run(GeneratedLevel level, LevelDescription levelDescription)
    { 
        if (!Enabled) {
          return;
        }

        // Your logic goes here
    }

If you do that, you can easily disable individual custom post-processing tasks in the editor.

What do you think?

r2d2m commented 3 years ago

Actually, I checked my code and I already did this ! (am at work)

It already works well, so yeah, only one checkbox is desirable 👍