UnrealSharp
  • Home
  • FAQ
  • Getting Started
    • Setup
    • Your First Script
    • Debugging
    • Packaging
  • Documentation
    • Classes
      • Properties
        • C++ Functions As C# Properties
        • C++ Properties with Getters/Setters
      • Functions
        • Flags
        • MetaData
      • Default Actor Components
      • Helper Methods
    • Structs
    • Enums
    • Interfaces
    • Delegates
    • Collections
      • TArray
      • TNativeArray
      • TSet
      • TMap
    • Multiplayer
      • Replicated Properties
      • RPCs (Remote Procedure Calls)
      • Replicated UObjects
    • Primary Data Assets
      • Loading Primary Data Assets
    • Loading Soft References
    • Trace Channels
    • Static Variables
      • FWorldStaticVar<T>
      • FGameStaticVar<T>
    • Logging
    • Async
    • Gameplay Tags
      • Gameplay Tag Container
    • Extension / Mixin Methods
    • Subsystems
    • Module Lifecycle
  • Links
    • Github Repository
    • Roadmap
    • Discord
Powered by GitBook
On this page
  1. Documentation
  2. Collections

TArray

Basic Array that is used in Unreal

Example of setting up an array and adding to it.

[UClass]
public class AMyShowcaseClass : AActor
{ 
    [UProperty(PropertyFlags.EditAnywhere | PropertyFlags.BlueprintReadWrite)]
    public TArray<int> Array { get; set; }

    protected override void BeginPlay()
    {
        base.BeginPlay();

        Array.Add(1);
    }    
}

TArray can also be represented as an IList inside of a UFunction

[UFunction(FunctionFlags.BlueprintCallable)]
public void TestList(IList<string> myList)
{
    PrintString($"List Count: {myList.Count}");
}
PreviousCollectionsNextTNativeArray

Last updated 8 months ago