Example #1
0
        public static List <string> GetGameObjectAutocompleteOptions(string basePath, string baseCommand)
        {
            // fetch the autocomplete options
            List <string> autocompleteOptions = CommandHelpers.GetNamesOfChildren(basePath);

            // if we got no autocomplete options then nothing to return
            if (autocompleteOptions == null || autocompleteOptions.Count == 0)
            {
                return(null);
            }

            // otherwise appeand the command to each of the options
            for (int index = 0; index < autocompleteOptions.Count; ++index)
            {
                string objectName = autocompleteOptions[index];

                // add in quotation mark if needed
                if (objectName.Contains(" "))
                {
                    objectName = "\"" + objectName + "\"";
                }

                autocompleteOptions[index] = baseCommand + " " + objectName;
            }

            return(autocompleteOptions);
        }