Search Unity

Question How do I make a Single Array in Visual Scripting?

Discussion in 'Visual Scripting' started by TheEmeraldWeegee, Jan 21, 2023.

  1. TheEmeraldWeegee

    TheEmeraldWeegee

    Joined:
    May 10, 2022
    Posts:
    2
    I am trying to make an audio volume detection system, and I am trying to use the "Audio Chip Get Data" node. It requires a "Data" element that is a "Single Array" of floats. In C# scripting, this is created by simply adding "[]" after the word "float" when defining a variable, but it doesn't exist in visual scripting as far as I know. Is there a specific type option or node library that I need to add? The image below is what the "Audio Chip Get Data" node uses for input. Thanks in advance!
     
  2. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    is called a list in visual scripting from some reason.

    you create a variable then in the drop down menu type "List of Float"

    you can also have this directly in the graph, right click and type "List of Float Literal"
     
  3. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    2,064
    UVS can't do arrays natively, but it typically can autocast lists to something an array input will accept, like ArrayList. As altepTest mentioned, use List<float> or use AotList.
     
  4. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,115
    yeah you right AOT is better as I've seen it can do more stuff than simple lists