Can't change effect preset through code

Effexer wrote on 11/10/2022, 7:55 PM

Just what the title says. I've got some code to add Chroma Keyer to some media, which works perfectly:
 

var plugInName = "Chroma Keyer"

var fx = vegas.VideoFX;

var plugIn = fx.GetChildByName(plugInName);

var effect = new Effect(plugIn);

videoEvent.Effects.Add(effect);

 

However, if I happen to have effect.Preset = "Blue Screen" for example, I get the error:

Despite it working perfectly if I don't try to set the Preset through code. Yes, I do have a working Preset with the name "Blue Screen" within my Chroma Keyer presets, so it really leaves me at a loss. Does anyone have any idea what's going on? I can't find any resources on the matter online.
I am using VEGAS Pro 20.0

Comments

walter-i. wrote on 11/11/2022, 1:39 AM
However, if I happen to have effect.Preset = "Blue Screen" for example, I get the error:

https://imgur.com/8Ya4lnn

@Effexer
Please embed your screenshot here - is possible with the icon to the left of the smiley - nobody likes to be linked to another page if it is not absolutely necessary.
Thanks

Effexer wrote on 11/11/2022, 5:01 AM
@Effexer
Please embed your screenshot here - is possible with the icon to the left of the smiley - nobody likes to be linked to another page if it is not absolutely necessary.
Thanks

My bad, I've changed it already.

jetdv wrote on 11/11/2022, 6:50 AM

@Effexer Have you looked at these?

Effexer wrote on 11/11/2022, 7:56 AM

@Effexer Have you looked at these?

Thank you very much @jetdv, the second video solved my problem. I think it was just an issue with me declaring the variables as "var" instead of using the proper datatypes, since I changed my code to match yours and it worked as I wanted.