How to render custom depth only when mouse is hovering over item

I’m trying to render a custom depth stencil I’ve made so that it outlines an object only when my mouse is hovering over it. I’ve tried this BP but it doesn’t seem to work, even with a print string after begin cursor over, it doesn’t print

Hi there,
I believe this video helps you. Results shown in time 23:50.

Hope that helps.

So this kinda works, I’ve made a blank mesh that prints when its clicked but I’m trying to use this for random objects that are children of another BP, they all have the clickable component but don’t seem to read it for some reason.

[EDIT] Yeah the whole thing works when on a normal static mesh but where my items are inheriting from another BP it doesn’t seem to be working

That’s unexpected. I’ll see if I can find anything helpful.

Thank you! I’ve gone through the whole video and it works perfectly on a new static mesh. I’m trying to get it on for example a shield on the floor. It is a child of a blank BP with an empty static mesh that’s filled in in the child BP, but for some reason it doesn’t get the outline.

1 Like

Great to know it worked for you. After assigning a new mesh, have you checked render custom depth?
Edit: never mind, you check render custom depth on mouse events.

I’ve got it set up using stencil values too so that I can have different colours and different items. They all have it set to on but not a stencil until hovered over, then I use the clickable component to change the stencil amount

[EDIT] although it doesn’t seem to be working on the parent actor either for some reason

1 Like

Can you show the code of assigning static meshes from child actor?
Is your clickable component set to auto-activate?

There isn’t actually any code for it I just swap out the mesh. And yeah it is

So it works only for new BPs?

Yeah it oddly seems like it, I added a blank weapon with the component and it works but with my other system it doesn’t work. I’m wondering if it’s something to do with the clickable component having "get component by static mesh component class

Are you picking the current mesh with get component by class, then selecting static mesh component, aren’t you? Does your object have more than one static mesh? If so, add a component tag to the correct mesh and use get component with tag instead.

I’m using Get Component by Class set to Static Mesh component in the clickable component. I have one BP called BP_Item that has a collider, Empty Static Mesh and the Clickable component. I’ve then created a child actor from this BP and changed the empty Static Mesh to a shield. The meshes only have 1 mesh

I can’t imagine what is causing this. I would guess if there’s something to do with mesh collision. Does your clickable component require static meshes with collision enabled? Also, on your begin cursor over, check if the static mesh is being considered as valid with a print string, get display name from static mesh.

I’ll see if I can find anything that can help you. Let’s see what other devs would recommend.

Thank you for all of your help though! I’ll keep trying to figure it out, although now I’ve somehow broken it even more and nothing works lol

1 Like

No problem, but don’t give up, try to find other videos with tutorials or try to search for past discussions in this forum. Keep up the good work.

Blueprint Runtime Error: “Accessed None trying to read property StaticMeshRef”. Node: Set Render Custom Depth Graph: EventGraph Function: Execute Ubergraph Clickable Component Blueprint: ClickableComponent

Now I’ve got this whenever I hover over things lol, I literally haven’t changed anything

Working with objects that can be changed in run-time can create this kind of error. You can add a “is valid?” node (that black one with a question mark icon) right after the hover events. Or, right click on static mesh variable, “convert to validated get” should do this trick.

Thank you, that’s gotten rid of the error, now I just need to figure out how to get the outline back as it’s stopped working on all meshes lol

It seems that the static mesh is not valid at all, that is the reason for the errors. Can you record a short video showing your playtest?