Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Change Material of a mesh with mouse click event in runtime with blueprint

Hi guys, I need to do something very specific and I don't know how, so if you be so kind to help me, i will be very grateful. I need a blueprint to assign to several actors (meshes) a property to change material with a mouse click over it. For example a Wood Wall change to a Concrete wall doing click over the mesh. The second that I need for the same meshes is show a specific text in HUD when the mouse pass over the specific mesh, with "mouseover" property. At the same time, when the cursor (crosshair) is passing over the mesh, change the drawing of the crosshair for something like "finger" or "clickable". The meshes are six in total.

Thank you again, and I hope you can help me



Product Version: Not Selected
more ▼

asked Mar 09 '15 at 11:28 PM in Blueprint Scripting

avatar image

8 8 11 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

3 answers: sort voted first

Well finaly i did this to make the material change. I post it if someone need to know how to do it. Is very simple.

Cheers! alt text

material.jpg (799.2 kB)
character.jpg (670.6 kB)
more ▼

answered Aug 12 '17 at 04:34 PM

avatar image

8 8 11 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Hi g0mo,

this should give you a great starting point

I created a variable click Id that will loop from 0 to 2. [0,1,2,0,1,2,0, etc], then I set a material on the current static mesh to the associated material created in the array.

Just be sure to set the correct material in your default variables

Cheers, alt text

more ▼

answered Mar 09 '15 at 11:45 PM

avatar image

715 28 12 40

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Thank you MarcAndreG, i will check and try to make it. Did you do it on Character Blueprint or in a new BluePrint? If I have some new question i will ask you again :)


more ▼

answered Mar 09 '15 at 11:55 PM

avatar image

8 8 11 13

avatar image MarcAndreG Mar 09 '15 at 11:59 PM

Sure do not hesitate if you have any questions.

This was on a new blueprint assumed to be the blueprint on which you want to click and have the material change.

avatar image g0mo Mar 10 '15 at 12:07 AM

Thanks for your good willingness.

Ok, so I will follow your steps.

In the blueprint appears "Material 1" "Material 2", etc. How do you add it in the blueprint?

what kind of action is the "Click id" and "Material" node?

This Blueprint works alone or with another?


avatar image MarcAndreG Mar 10 '15 at 02:05 AM

If you're not sure how to add variable to a blueprint, I think the first step would be to go watch a few tutorial to get the hang of it.

If you've never touched UE4 / blueprints, the Unreal has great tutorial series too that I'd recommend watching https://wiki.unrealengine.com/Videos

Here's one made by someone(aka not unreal) that seems to teach how to handle mouse click and touch events. It's probably with a previous version of the engine but it still will get you some insight. https://www.youtube.com/watch?v=eddauM-nP4U


avatar image g0mo Mar 12 '15 at 03:01 AM

Hi MarcAndreG, I watched all the videos and now I understand the concept of variable and how can I create it, but I still having doubts about a lot of things.

The first thing that I'm trying to do is change the mouse cursor image (a custom image) when pass over a specific mesh. I know that I have to intervene 3 differents blueprint: Mouse_Controller, HUD and Mesh Blueprint (seeing how do I built my demo).

In the Mouse_Controller BluePrint I created two variables: "Mouse Pointer Image" (change the image of cursor) and "Shift Mesh" (variable that represent the mesh that makes the mouse's cursor changes when it's over it).

And two Events: "Begin Mouse Over" and "End Mouse Over".

Basing on my low knowledge I think (in logical terms) would be like:

  1. Mouse pass over the mesh (Event happen)

  2. The Mouse Cursor change its image.

Following this, I connect "Begin Cursor Over" with "Set Mesh" with "Mouse Pointer Image", but I receive an error: "Literal values are not allowed for array parameters"

I understand that I'm connecting nodes from different nature between them, but I don't know how connect them or what conversor node have to use.

alt text

In HUD BluePrint, apparently everything its ok.

alt text

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question