ScriptPlayableAssetMatSetParam.cs 730 B

1234567891011121314151617181920212223
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Playables;
  5. [System.Serializable]
  6. public class ScriptPlayableAssetMatSetParam : PlayableAsset
  7. {
  8. public ExposedReference<Material> mat;
  9. public string paramName;
  10. public float paramNum;
  11. // Factory method that generates a playable based on this asset
  12. public override Playable CreatePlayable(PlayableGraph graph, GameObject go)
  13. {
  14. ScriptPlayableTrackMatSetParam matPlayable = new ScriptPlayableTrackMatSetParam();
  15. matPlayable.mat = mat.Resolve(graph.GetResolver());
  16. matPlayable.tarParamNum = paramNum;
  17. matPlayable.Init(paramName);
  18. return Playable.Create(graph);
  19. }
  20. }