// -----JS CODE-----
//@input Asset.Material[] mats
/** @type {Material[]} */
var mats = script.mats;

//@input Component.RenderMeshVisual renderMeshVisual
/** @type {RenderMeshVisual} */
var renderMeshVisual = script.renderMeshVisual;

renderMeshVisual.mainMaterial = getRandomItem(mats);


/**
* @template T
* @param {T[]} list
* @returns {T}
*/
function getRandomItem(list) {
    var index = Math.floor(Math.random() * list.length);
    return list[index];
 }