Ejemplo n.º 1
0
        /// <summary>
        ///     returns a List if names of the variables visible in the inspector on the UdonBehaviour
        /// </summary>
        /// <param name="udonBehaviour"></param>
        /// <returns></returns>
        /// <exception cref="ArgumentException">if udonBehaviour is invalid</exception>
        public static List <string> GetInspectorVariableNames(this UdonBehaviour udonBehaviour)
        {
            if (!udonBehaviour)
            {
                throw new ArgumentException("Invalid UdonBehaviour");
            }

            try
            {
                return(new List <string>(udonBehaviour.GetSymbolTable().GetExportedSymbols()));
            }
            catch (Exception e)
            {
                Debug.Log(e.Message + " (skipping)", udonBehaviour);
                return(new List <string>());
            }
        }
Ejemplo n.º 2
0
 private static void GetVariableType(UdonBehaviour udonBehaviour, string symbolName, out Type variableType,
                                     IUdonVariableTable publicVariables, UdonSharpProgramAsset programAsset)
 {
     if (!publicVariables.TryGetVariableType(symbolName, out variableType))
     {
         var symbolTable = udonBehaviour.GetSymbolTable();
         if (symbolTable.HasAddressForSymbol(symbolName))
         {
             var symbolAddress = symbolTable.GetAddressFromSymbol(symbolName);
             var program       = programAsset.GetRealProgram();
             variableType = program.Heap.GetHeapVariableType(symbolAddress);
         }
         else
         {
             variableType = null;
         }
     }
 }