cakeslice / Outline-Effect

Outline Image Effect for Unity
MIT License
1.48k stars 201 forks source link

Performance issues in Editor mode #62

Open rafaeldolfe opened 1 year ago

rafaeldolfe commented 1 year ago

For some reason the outline spikes over and over in edit mode. I've found this out using the profiler. My scene has many, many sprites, but only a few of them have outlines. Playmode runs OK, but edit mode is slow. Profiler is reporting issues around/in SceneView drawing. (If I close the Scene tab, performance goes up significantly. Same with Game tab too though.)

cakeslice commented 1 year ago

@rafaeldolfe Can you provide a simple scene that reproduces the issue please?

rafaeldolfe commented 1 year ago

So I made a new scene and added a bunch of sprites. (FYI: this is a new scene within a larger project)

image

All of these sprites have just a sprite renderer and a normal sprite on it.

image

I have a normal camera in the scene with an OutlineEffect attached to it.

image

The performance, unfortunately, is hitting back in edit mode. It spikes with a relatively consistent pattern where the OnGUI method seems to eat tons of CPU. I don't know why.

image

The outline effect itself is visible in the game view and looks great. Performance in play mode is also totally fine. It's just not playing nice with edit mode.

As the screenshot shows, no problems in play mode.

image

rafaeldolfe commented 1 year ago

@cakeslice This outline is so great otherwise Q_Q Could you perhaps give me a hint as to what might be the problem?

rafaeldolfe commented 1 year ago

I did a deep profile and found some interesting results.

It does like a lot of the spikes are from the ProfilerWindow (which is good in a way), but I do still get 6 ms in the SceneView and 4.5 ms in the GameView (OnGui the main culprit for both).

image