GetDataTree() error - input type is GH_Number but requested type is IGH_Goo

Hello all,
I’m working on a grasshopper component in C# that takes input from a datatree with multiple datatypes (strings, ints, floats all packed in one). I understand that to import this type, one needs to use IGH_Goo when using GetDataTree(). However, when I do so I get the following error:

The code snippet (if needed) is below:

      protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
        {

            pManager.AddNumberParameter("Database", "DTB", "Data", GH_ParamAccess.tree);
        }

 


        /// <summary>
        /// Registers all the output parameters for this component.
        /// </summary>
        protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
        {
            pManager.AddGenericParameter("Connection", "C", "Connector_information", GH_ParamAccess.list);
        }

        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            List<EleType> members = new List<EleType>();
            int connection = 0;
            int design_standard = 0;
            GH_Structure<IGH_Goo> DB;          
    
            if (!DA.GetDataList(0, members)) return;
            if (!DA.GetData("Connection", ref connection)) return;
            if (!DA.GetData("Design Standard", ref design_standard)) return;
            if (!DA.GetDataTree(3, out DB)) return;      

        }

Where am I going wrong ?

Try:


GH_Structure<IGH_Goo> DB = new GH_Structure<IGH_Goo>();  

(...)

 if (!DA.GetDataTree(3, ref DB)) return;

Thanks Dani, unfortunately I’m still getting the same error.

Wait, you are only registering a single number parameter, that’s the problem. If you get 4 inputs, you have to registerthem and the last one, it must be a generic_object param (I don’t remember the name), not a numeric input.

That was it ! Thanks a million Dani !