No announcement yet.

Pass Material Instance to Function

  • Filter
  • Time
  • Show
Clear All
new posts

    Pass Material Instance to Function

    I want to create a function that takes a material instance as a parameter and then does some things to it. How do I set the function to accept a material instance as a parameter?

    You mean a material instance that takes a material parameter collection that is then altered by a function?
    Map Generator 1.0
    Map Generator 2.0
    Map Generator 3.0


      Um, I'm not sure, you've confused me?

      In the construction script I create some material instances from some materials.

      Then in the event graph I do some things to those material instances in order to animate them. I'm doing the same set of steps to each material instance. So I thought, maybe I could create a function of these steps (nodes) and then just pass in the material instance to the function, so I don't have to have all the nodes duplicated for each material instance in the event graph.


        OK, so I worked out how to create an input variable to the function, which I've set to be a Material Instance. In the event graph I have the material instance connecting to a Get Vector Parameter Value node. However it won't let me do that in the function with the material instance input. See below.

        Event Graph - Working
        Click image for larger version

Name:	1.png
Views:	1
Size:	55.3 KB
ID:	1075473

        Function - Not Working
        Click image for larger version

Name:	2.png
Views:	2
Size:	48.0 KB
ID:	1075474