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"

Can I bind a Dynamic Material Instance parameter to a variable for automatic updates?

Is it possible to bind a variable in a class to a dynamic material instance parameter so that changing the variable automatically changes the material instance?

I have a pawn with a dynamic material instance that has color parameter, and I want that color to be reflected by a LinearColor variable stored in the pawn, similarly to how you can bind a function to a LinearColor attribute for a Text component in a Widget and then whenever you change the variable the text also changes its color automatically.

Or is the only way to do this to make an event fire off whenever I change the color variable and then manually set the dynamic instance parameter value whenever that event fires?

Product Version: UE 4.19 Preview
more ▼

asked Feb 28 '18 at 03:07 PM in Blueprint Scripting

avatar image

56 7 13 16

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

2 answers: sort voted first

You'll have to create an event, or alternatively, use a material animation curve that's named the same as the material parameter.

more ▼

answered Feb 28 '18 at 03:27 PM

avatar image

589 22 23 41

avatar image Mars- Feb 28 '18 at 04:25 PM

Welp, event it is then!

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

Not directly... but if you want it badly, you can create a variable that has Replication setting set to RepNotify (it is a networking tool). Then, inside the OnRep_variableName function you can call the event to change specified material parameter.

Whenever you use "set" operation on this variable, the OnRep function will fire. Note: increment/decrement will not fire this event, but you can set the value of variableName with the value of variableName ;)

more ▼

answered Feb 28 '18 at 03:30 PM

avatar image

240 3 12 13

avatar image DamirH Feb 28 '18 at 03:33 PM

This will only work for BP variables and has terrible and unnecessary overhead for this purpose.

avatar image ChopinDev Feb 28 '18 at 03:40 PM

True about C++, it would require additional function call, which is pointless, as OP wanted just to change the variable. Overhead? I'm 99% sure it won't be the performance killer, it would had to be very specific project...

avatar image DamirH Feb 28 '18 at 04:22 PM

True but it is still going through network-intended channels and the whole replication mechanism just to avoid a single function call.

avatar image Mars- Feb 28 '18 at 04:27 PM

This is a multiplayer game, so since I can't bind the parameter to a variable I'm going to have to use a NetMulticast function anyway.

(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