Multidimentional array parameters for a function should work... right?

I’m currently using the tutorial on linking dynamic libraries to try and add Libnoise to a test project. In the chunk of code below, the example given is declaring a function that only requires a float:


#pragma once
 
#include "GameFramework/Actor.h"
#include "Libraries.generated.h"
 
/**
 * Meaningful and useful comment goes here.
 */
UCLASS()
class ULibraries : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()
 
        // Blueprint accessible method.
	UFUNCTION(BlueprintCallable, Category = "Karma Libraries")
	static float getCircleAreaDLL(float radius);	
};

However, when I modify this code so that it declares a function with an array of an array of floats (as pointers to pointers) instead-


class NOISETEST_API ANoiseDisplay : public AHUD
{
	GENERATED_UCLASS_BODY()
	
		// Blueprint accessible method.
		UFUNCTION(BlueprintCallable, Category = "Karma Libraries")
		static void generateNoiseMapDLL(float **radius);
	
};

-and make the corresponding change in the .cpp file, I get this error when building:


1>------ Build started: Project: NoiseTest, Configuration: Development_Editor x64 ------
2>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>Project not selected to build for this solution configuration 
1>  Compiling game modules for hot reload
1>  Parsing headers for NoiseTestEditor
1>  B:/Unreal Projects/NoiseTest/Source/NoiseTest/NoiseDisplay.h(19) : Missing variable name
1>Error : Failed to generate code for NoiseTestEditor - error code: OtherCompilationError (5)
1>  UnrealHeaderTool failed for target 'NoiseTestEditor' (platform: Win64, module info: B:\Unreal Projects\NoiseTest\Intermediate\Build\Win64\NoiseTestEditor\Development\UnrealHeaderTool.manifest).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""B:\Epic Games\4.8\Engine\Build\BatchFiles\Build.bat" NoiseTestEditor Win64 Development "B:\Unreal Projects\NoiseTest\NoiseTest.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

If I change it so it’s a regular 2D array (no pointers), then I get this error:


1>------ Build started: Project: NoiseTest, Configuration: Development_Editor x64 ------
2>------ Skipped Build: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------
2>Project not selected to build for this solution configuration 
1>  Compiling game modules for hot reload
1>  Parsing headers for NoiseTestEditor
1>  B:/Unreal Projects/NoiseTest/Source/NoiseTest/NoiseDisplay.h(19) : Function parameter radius: Missing ']'
1>Error : Failed to generate code for NoiseTestEditor - error code: OtherCompilationError (5)
1>  UnrealHeaderTool failed for target 'NoiseTestEditor' (platform: Win64, module info: B:\Unreal Projects\NoiseTest\Intermediate\Build\Win64\NoiseTestEditor\Development\UnrealHeaderTool.manifest).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.MakeFile.Targets(38,5): error MSB3073: The command ""B:\Epic Games\4.8\Engine\Build\BatchFiles\Build.bat" NoiseTestEditor Win64 Development "B:\Unreal Projects\NoiseTest\NoiseTest.uproject" -rocket" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 1 skipped ==========

What am I doing wrong?

Code for class (header posted earlier):


// Fill out your copyright notice in the Description page of Project Settings.

#include "NoiseTest.h"
#include "NoiseDisplay.h"



void ANoiseDisplay::generateNoiseMapDLL(float **radius)	
{


}

Have you tried using a 2D TArray instead?

I hadn’t heard of TArrays before, so I read up on it, and also on multidimensional versions. 1D TArrays are pretty straightforward, but the means for creating multidimensional TArrays is pretty awkward. It’s not very bad for 2D so I don’t mind using it, but more than that seems annoying. Is there no way to do things the regular way with pointers or just a regular multidimensional array?

Any type you use with a UFUNCTION needs to have built in support in blueprints. Pointers and multidimensional arrays are not supported.

You’re trying to declare a blueprint callable function with a pointer/md-array as a parameter. How were you planning to invoke this function from a blueprint? What were you planning to pass into it?

It’s true making multidimensional arrays out of nested TArrays is ugly, especially for anything above 2D. There are a couple of options though:

  1. Flatten your array to 1D. Anything using it should know its underlying dimensionality and sizes and index the elements accordingly.
  2. Create a UObject to wrap a multidimensional array with functions to access the elements by an index in each dimension, and pass the object around instead.