# How to get texture 2d array size in blueprint?

**URL:** <https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [April 7, 2023, 11:35pm UTC](https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763 "2023-04-07T23:35:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sivasubramanian5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sivasubramanian5](https://forums.unrealengine.com/u/Sivasubramanian5)\
**Post date:** [April 7, 2023, 11:35pm UTC](https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763/1 "2023-04-07T23:35:26Z")

</div>

I’m trying to get the array size of a texture 2d array object in blueprint. Searched on google and there seems to be no docs on this.

---

<div class="post-metadata">

**Author:** ![rokenrock](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rokenrock/32/1040844_2.png) [@rokenrock](https://forums.unrealengine.com/u/rokenrock)\
**Post date:** [April 8, 2023, 12:15am UTC](https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763/2 "2023-04-08T00:15:45Z")

</div>

It seems that there is no blueprint accessible logic for accessing the size, but it does exist in C++ as `int32 GetArraySize() const;`

You can make this accessible to blueprints via a BlueprintFunctionLibrary like so:

```auto
	UFUNCTION(BlueprintCallable, BlueprintPure, Category="Texture2DArray", meta=(CompactNodeTitle="Length"))
	static UPARAM(DisplayName=" ") int32 GetTexture2DArrayLength(const UTexture2DArray* Texture2DArray)
	{
		return Texture2DArray->GetArraySize();
	}

```

or without the frills:

```auto
	UFUNCTION(BlueprintCallable)
	static int32 GetTexture2DArrayLength(const UTexture2DArray* Texture2DArray)
	{
		return Texture2DArray->GetArraySize();
	}

```

It doesn’t have to be in a blueprint function library, but it makes most sense to put it in one.

* * *

For those who don’t have C++ set up, below are instructions on how to quickly do that, no experience needed.

Follow this video guide, but when he says to select none when adding the C++ class, instead scroll down and add a blueprint function library.

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/f/2/2/f2231ab31a7358c4ddf25947ba469a6395df07ce.png)  
Additionally, when he does “Advanced build actions → rebuild selected projects,” you can just press the play icon or hammer icon, whichever you can find in visual studio.  
[https://www.youtube.com/watch?v=tW1\_rD0Geiw](https://www.youtube.com/watch?v=tW1_rD0Geiw)

Add in the code, and it should look something like this (YETANOTHERTESTING\_API will be different for you)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/f/e/9fec8fad4e87fc0d89901b54e5cd9c1334a899e2.png)

---

<div class="post-metadata">

**Author:** ![Sivasubramanian5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Sivasubramanian5](https://forums.unrealengine.com/u/Sivasubramanian5)\
**Post date:** [April 8, 2023, 10:54am UTC](https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763/3 "2023-04-08T10:54:15Z")

</div>

@rokenrock Thanks for your reply. But I was not able to access these in blueprint. How to do it? And I would like to do this in texture2darray to reduce texture samples.

---

<div class="post-metadata">

**Author:** ![WpWhite](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@WpWhite](https://forums.unrealengine.com/u/WpWhite)\
**Post date:** [June 2, 2024, 4:23am UTC](https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763/4 "2024-06-02T04:23:22Z")

</div>

Bump. Looking to count those textures also.

---

<div class="post-metadata">

**Author:** ![rokenrock](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rokenrock/32/1040844_2.png) [@rokenrock](https://forums.unrealengine.com/u/rokenrock)\
**Post date:** [June 2, 2024, 5:18pm UTC](https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763/5 "2024-06-02T17:18:18Z")

</div>

My bad- I’ve rewritten the reply to properly answer the question. Let me know if there are any issues

---

<div class="post-metadata">

**Author:** ![Lutdan](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Lutdan](https://forums.unrealengine.com/u/Lutdan)\
**Post date:** [August 6, 2024, 12:46pm UTC](https://forums.unrealengine.com/t/how-to-get-texture-2d-array-size-in-blueprint/876763/6 "2024-08-06T12:46:35Z")

</div>

![tex](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/5/b/25bb2044f0ebadf143cb7aa5283e549c79b9ea18.png)  
You can convert Texture to Texture2d and get the rows and columns. If you have access to the Texture and not only Texture2DArray.
