Skip to content

How to ensure outline is at correct "depth"? #32

@josephmalam

Description

@josephmalam

I really like this asset, thank you very much for developing it and releasing it for free!

I want to use it to highlight objects the player can interact with when they are inside a collider object, like here:

https://i.stack.imgur.com/0Irdw.png

My issue is that the outline does not seem to be at the right z-index depth — as you see in the bottom right corner of the object, the player's hair is "under" the outline.

My code is:

private void OnTriggerEnter(Collider other)
    {
        if (other.name == "Player")
        {
            var outline = gameObject.AddComponent<Outline>();
            outline.OutlineMode = Outline.Mode.OutlineAll;
            outline.OutlineColor = Color.yellow;
            outline.OutlineWidth = 3f;
        }
    }

Is there any way to prevent this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions