0
\$\begingroup\$

I'm trying to follow the modular character tutorial for Unreal from this link Specifically the mesh merge portion. How ever the code that is provided seems to not be working.

For example when I add this piece of code :

USTRUCT(BlueprintType)
struct VR_API FSkelMeshMergeSectionMapping_BP
{
    GENERATED_BODY()
        UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Mesh Merge Params")
        TArray<type> SectionIDs;
};

I get the following error : Unrecognized type 'type' - type must be a UCLASS, USTRUCT or UENUM

I;m guessing I should provide a certain type in the <> but I have no idea what it should be. I've been using unreal only for 2 days now so if anyone can help me figure this tutorial out and get it working I would be thankful.

\$\endgroup\$
0
\$\begingroup\$

TArray is a template type in Unreal, which means you need to give it template parameters (within the angle brackets) when declaring one. In the case of TArray, you need at a minimum to indicate the type of data stored in the array. What you've written in your example is "a TArray of instances of type" and the error is telling you that there is no type named type.

"Section IDs" sound like they'd be integers, so you should probably write TArray<int> to create an array of ints. Or whichever other integer type is appropriate.

(Other than TArray itself, which is an Unreal type, this is a general C++ problem regarding templates, so if you are looking for more background you don't need to look for Unreal-specific information... although the specific error you are seeing is an Unreal-specific one arising from how it parses your code and applies extra validation to UPROPERTY members, in this case putting additional constraints on the type parameter. TArray is roughly analogous in intent to the C++ standard library type std::vector.)


Reading through that tutorial link in more detail, much of the code samples seem to suffer from errors like this, including several declarations of TArray with no template parameters at all (which won't compile) as well as some stray characters at the end of some of the snippets.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.