Hello
Im trying to utilize a custom editor for my project to help me on scripted dialogues. Basicly I have json files with dialog entries, with my custom editor script I can read this entries and create a voice from with the help of AI, Im be able to save this text entries to string table and I want also save this audioclips to asset table but I couldnt do it.
if (scenario.voiceTable)
{
foreach (var chapter in scenario.transcript.chapters)
{
foreach (var radio in chapter.radioTranscripts)
{
if (radio.voice != null)
{
var sharedTableEntry = scenario.voiceTable.SharedData.GetEntry(radio.code);
if (sharedTableEntry == null)
{
sharedTableEntry = scenario.voiceTable.SharedData.AddKey(radio.code);
}
if(scenario.voiceTable.TryGetValue(sharedTableEntry.Id, out var entry))
{
entry.SetAssetOverride(radio.voice);
}
else
{
var newentry = scenario.voiceTable.CreateTableEntry();
newentry.Key = radio.code;
//newentry.Address = how can I get address?
scenario.voiceTable.Add(sharedTableEntry.Id, newentry);
}
}
}
}
EditorUtility.SetDirty(scenario.voiceTable);
AssetDatabase.SaveAssetIfDirty(scenario.voiceTable);
}
if (scenario.subtitleTable)
{
foreach (var chapter in scenario.transcript.chapters)
{
foreach (var radio in chapter.radioTranscripts)
{
var sharedTableEntry = scenario.subtitleTable.SharedData.GetEntry(radio.code);
if(sharedTableEntry == null)
sharedTableEntry = scenario.subtitleTable.SharedData.AddKey(radio.code);
if (scenario.subtitleTable.TryGetValue(sharedTableEntry.Id, out var entry))
{
entry.Value = radio.text;
}
else
{
scenario.subtitleTable.AddEntry(sharedTableEntry.Id, radio.text);
}
}
}
EditorUtility.SetDirty(scenario.subtitleTable);
AssetDatabase.SaveAssetIfDirty(scenario.subtitleTable);
}