private CKlaxScriptRegistry()
        {
            AddDefaultTypes();
            FindTypes();
            RegisterCustomNodeFactories();

            m_codeGenerator.CompileFunctions(Types, LibraryFunctions);
            m_codeGenerator.LoadCompiledFunctions(Types, LibraryFunctions);

            s_instance = this;
        }
        private void OnTargetMethodChanged()
        {
            OutputPins.Clear();
            InputPins.Clear();

            CKlaxScriptRegistry registry = CKlaxScriptRegistry.Instance;

            registry.TryGetFunctionInfo(TargetMethod, out CKlaxScriptFunctionInfo outFunctionInfo);

            Name = outFunctionInfo.displayName;

            if (TargetMethod.ReturnType != typeof(void))
            {
                COutputPin returnOutput = new COutputPin()
                {
                    Name = "Return",
                    Type = TargetMethod.ReturnType,
                };
                OutputPins.Add(returnOutput);
            }

            if (!TargetMethod.IsStatic)
            {
                CInputPin targetObjectInput = new CInputPin()
                {
                    Name                 = "Target",
                    Type                 = TargetMethod.DeclaringType,
                    Literal              = null,
                    SourceNode           = null,
                    SourceParameterIndex = -1,
                    StackIndex           = -1,
                };
                InputPins.Add(targetObjectInput);
            }

            ParameterInfo[] methodParameters = TargetMethod.GetParameters();
            for (var index = 0; index < methodParameters.Length; index++)
            {
                ParameterInfo parameter   = methodParameters[index];
                Type          elementType = parameter.ParameterType;
                if (parameter.ParameterType.IsByRef)
                {
                    elementType = parameter.ParameterType.GetElementType();
                    if (!parameter.IsIn)
                    {
                        m_additionalReturns.Add(index);
                        COutputPin output = new COutputPin()
                        {
                            Name = parameter.Name,
                            Type = elementType,
                        };
                        OutputPins.Add(output);
                    }
                }

                if (parameter.IsOut)
                {
                    continue;
                }

                CInputPin input = new CInputPin()
                {
                    Name                 = outFunctionInfo.inputParameterNames[index],
                    Type                 = elementType,
                    SourceNode           = null,
                    SourceParameterIndex = -1,
                    StackIndex           = -1,
                };

                input.Literal = input.Type.IsValueType ? Activator.CreateInstance(input.Type) : null;
                InputPins.Add(input);

                m_functionProxy = new SKlaxScriptFunctionProxy(outFunctionInfo);
            }
        }