// Factory method that generates a playable based on this asset public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { var playable = ScriptPlayable <ImageColorBehaviour> .Create(graph, data); ImageColorBehaviour clone = playable.GetBehaviour(); return(playable); }
// Called each frame while the state is set to Play public override void PrepareFrame(Playable playable, FrameData info) { if (image == null) { return; } int inputCount = playable.GetInputCount(); Color blendColor = Vector4.zero; for (int i = 0; i < inputCount; i++) { var playableInput = (ScriptPlayable <ImageColorBehaviour>)playable.GetInput(i); ImageColorBehaviour input = playableInput.GetBehaviour(); float inputWeight = playable.GetInputWeight(i); blendColor += input.color * inputWeight; } image.color = blendColor; }