UnityFx.Outline
UnityFx.Outline copied to clipboard
Explicitly set renderers on OutlineBehaviour
Is there a way to set renderers from the inspector?
I would like to control this. Sometimes not all child objects should be outlined. Sometimes renderers are not child objects. I think that makes sense.
I was able to overcome this limitation by writing my own script based on OutlineBehaviour.cs
.
Still, it would be cool to have this feature out of the box. Feature request or smth :)
You can set ignore layers value to exclude objects from rendering. OutlineBehaviour's purpose is rendering outline of a game object it is attached to. There are other tools if you need to do more complex outlines (like OutlineEffect + OutlineLayerCollection). Did you try them?
You can set ignore layers value to exclude objects from rendering.
Yeah, but I'm trying to avoid abusing layers.
OutlineBehaviour's purpose is rendering outline of a game object it is attached to. There are other tools if you need to do more complex outlines (like OutlineEffect + OutlineLayerCollection). Did you try them?
I looked at them but I didn't like this approach. I have a complete project that uses OutlineBehaviour-like script so for me it was easier to completely rewrite already used script with code from OutlineBehaviour with some changes to support explicit renderers setup. This way migration was easy as writing this script and not manually change every use of the old script.
.
.
Why I think OutlineBehaviour should support explicitly specified renderers:
Consider a situation where we have an interactable door in the scene. When player looks at the door only the handle should be outlined, not the whole door.
Yes, in some cases we could add OutlineBehaviour directly to handle and just use GetComponentInChildren<OutlineBehaviour>()
instead of simply GetComponent from the door gameobject, but it's inconvenient and messes up the scene. IMHO
There is OutlineBehaviour.OutlineRenderers
property, which provides access to the OutlineBehaviour
's list of renderers. So, while you cannot change the renderers from inspector, you can do that using simple script. Does that resolve the issue?
So, while you cannot change the renderers from inspector, you can do that using simple script.
Yes, I know that, I just don't see any reason why not to let users explicitly specify OutlineRenderers from the inspector. Just my opinion :)
As I wrote before, I solved my problem by writing my own script based on OutlineBehaviour. It was easy because you really nailed it, system design is so clean and decoupled.
The reason is editor code required for such things, which I really hate writing :).
Ahh yes:)) Understandable) I could make PR if you confirm this feature
Thank you, I think that's not nessesary. Most likely I'll bump minimum Unity version to 2020 LTS and use built-in arrays (they are presented as reorderable lists out of the box).
@Arvtesh It doesn't seem like this has happened yet. Do you have any plans to follow through? I have the same use case as @STARasGAMES and would greatly appreciate the change.
Yes, as soon as I have time. Cannot give any estimates though.