I tried various ways to set the Switch Group property of a Switch Container but I can't get it to work.
I first create a random container with two Switch Containers. I then iterate through the Switch Containers and my intention is to apply a Switch Group to each one.
function createObject(session){
var container = {
"parent": "{8250D45E-B369-40D4-A2D2-62DE313EBA7F}",
"type": "RandomSequenceContainer",
"name": "RandContainer",
"@RandomOrSequence": 1,
"children": [
{
"type": "SwitchContainer",
"name": "A",
"children" : [
{"type" : "Sound", "name" : "aa"},
{"type" : "Sound", "name" : "bb"},
{"type" : "Sound", "name" : "cc"},
{"type" : "Sound", "name" : "dd"}
]
},
{
"type": "SwitchContainer",
"name": "B",
"children" : [
{"type" : "Sound", "name" : "ee"},
{"type" : "Sound", "name" : "ff"},
{"type" : "Sound", "name" : "gg"},
{"type" : "Sound", "name" : "hh"}
]
}
]
}
session.call('ak.wwise.core.object.create', [], container ).then(
function(res) {
var children = res.kwargs.children
children.map((child) => {
console.log(child.id)
const st = {
"object" : child.id,
"reference" : 'StateGroup', <----------- //I tried 'State', 'Switch', "StateGroup", "SwitchGroup", "SwitchContainer" also tried "property" instead of "reference"
"value" : '{F1B87108-BC75-4400-8556-AD5235907703}'
}
session.call('ak.wwise.core.object.setReference', [], st).then( <----------- //Here I tried .setProperty, when using "reference" in the above object. Also I tried having the object as the second argument in the method...
function(r) {
console.log(r)
},
function(e){
console.log(e)
}
)
})
},
function (error) {
console.log('error: ', error);
}
).then(
function() {
connection.close();
}
);
}
One more thing - How would I go about associating a sound file to a particular State?