Home Unreal Engine

Stopping construction script from recompiling when instance is transformed

polycounter lvl 10
Offline / Send Message
Pinned
supremedalek925 polycounter lvl 10
Hi. I was hoping someone could help me figure this one out.  In UE4, I've made a blueprint that sets a dynamic material instance for its mesh component.  I want the construction script to run when the blueprint is dragged into the scene or when the blueprint is duplicated so that every instance has different randomization for their material.  So far, this works.  The problem is, the construction script is also running every time a translation such as movement, rotation, or scale is applied to the blueprint within the editor.  I want the designer to be able to pick which instances they like and move them into place accordingly which is why this poses a problem.  Could anyone point me to a solution? Thank you.

Replies

  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    A neat workaround is to use seeded random. That will give you the same random number every time, unless you change the seed. You can have a variable that is random stream type, and get random values from that.
  • supremedalek925
    Options
    Offline / Send Message
    supremedalek925 polycounter lvl 10
    Obscura said:
    A neat workaround is to use seeded random. That will give you the same random number every time, unless you change the seed. You can have a variable that is random stream type, and get random values from that.
    Thank you very much for the tip!  I've got it working exactly how I want now.
  • Obscura
    Options
    Offline / Send Message
    Obscura grand marshal polycounter
    There is also this checkbox, this would do what you originally asked for, probably better in this case, it would give you slightly better performance IN EDITOR because it wouldn't re execute when you move it. But.... Random stream would also work in multipleyer for example, each player could get the same looking instances, so maybe you want both of these.


Sign In or Register to comment.