How to add wmts component dynamic at runtime

i want to add wmts component to 3dtile, the step is:

  1. create wmts component
  2. the wmts component will use function add to 3dtile action ,i dad not call function attach component to component
  3. add properties to wmts,and call function refresh
  4. 3dtile action will call function refresh 3dtile

do like this ,it will not sucessful;but in editor, the same properties will sucess.

should contect terrain node