Hello, i can’t create new Event FMOD from Unity because i have many banks, so it meet error when BuildTree function in CreateEventPopup.cs
{
var rootGuid = EditorUtils.GetScriptOutput("studio.project.workspace.masterEventFolder.id");
rootFolder = new FolderEntry();
rootFolder.guid = rootGuid;
BuildTreeItem(rootFolder);
wantsMouseMove = true;
banks = new List();
const string buildBankTreeFunc =
@"function() {
var output = """";
const items = [ studio.project.workspace.masterBankFolder ];
while (items.length > 0) {
var currentItem = items.shift();
if (currentItem.isOfType(""BankFolder"")) {
currentItem.items.reverse().forEach(function(val) {
items.unshift(val);
});
} else {
output += "","" + currentItem.id + currentItem.getPath().replace(""bank:/"", """");
}
}
return output;
}";
string bankList = EditorUtils.GetScriptOutput(string.Format("({0})()", buildBankTreeFunc));
string[] bankListSplit = bankList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var bank in bankListSplit)
{
var entry = new BankEntry();
entry.guid = bank.Substring(0, 38);
entry.name = bank.Substring(38);
banks.Add(entry);
}
}`
when i increaseto bigger 2048 bytes in this function at EditorUtils, it works…
public static string GetScriptOutput(string command)
{
byte[] commandBytes = Encoding.UTF8.GetBytes(command);
try
{
ScriptStream.Write(commandBytes, 0, commandBytes.Length);
byte[] commandReturnBytes = new byte[2048];
int read = ScriptStream.Read(commandReturnBytes, 0, commandReturnBytes.Length);
string result = Encoding.UTF8.GetString(commandReturnBytes, 0, read - 1);
if (result.StartsWith("out():"))
{
return result.Substring(6).Trim();
}
return null;
}
catch (Exception)
{
networkStream.Close();
networkStream = null;
return null;
}
}
What should i do? many thanks!!