Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly set renderers on OutlineBehaviour #32

Open
STARasGAMES opened this issue Jul 24, 2021 · 10 comments
Open

Explicitly set renderers on OutlineBehaviour #32

STARasGAMES opened this issue Jul 24, 2021 · 10 comments
Labels
question Further information is requested

Comments

@STARasGAMES
Copy link

Is there a way to set renderers from the inspector?
image

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.

@STARasGAMES
Copy link
Author

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 :)

@Arvtesh Arvtesh added the question Further information is requested label Jul 24, 2021
@Arvtesh
Copy link
Owner

Arvtesh commented Jul 24, 2021

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?

@STARasGAMES
Copy link
Author

STARasGAMES commented Jul 24, 2021

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

@Arvtesh
Copy link
Owner

Arvtesh commented Aug 17, 2021

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?

@STARasGAMES
Copy link
Author

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.

@Arvtesh
Copy link
Owner

Arvtesh commented Aug 17, 2021

The reason is editor code required for such things, which I really hate writing :).

@STARasGAMES
Copy link
Author

Ahh yes:)) Understandable)
I could make PR if you confirm this feature

@Arvtesh
Copy link
Owner

Arvtesh commented Aug 23, 2021

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).

@insominx
Copy link

@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.

@Arvtesh
Copy link
Owner

Arvtesh commented Jul 13, 2022

Yes, as soon as I have time. Cannot give any estimates though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants