Scribe
Scribe

Gostou? Torne o Scribe ainda melhor deixando uma avaliação

Obter Extensão do Chrome

Navegar

  • Vídeos Populares
  • Vídeos Recentes
  • Todos os Canais

Ferramentas Gratuitas

  • Baixador de Legendas de Vídeo
  • Gerador de Marcadores de Tempo de Vídeo
  • Resumidor de Vídeos
  • Contador de Palavras de Vídeo
  • Analisador de Títulos de Vídeo
  • Busca de Transcrições de Vídeo
  • Análises de Vídeo
  • Criador de Capítulos de Vídeo
  • Gerador de Quiz de Vídeo
  • Chat com Vídeo

Produto

  • Preços
  • Blog
  • Obter Extensão do Chrome

Developers

  • Transcript API
  • API Documentation

Legal

  • Termos
  • Privacidade
  • Suporte
  • Mapa do Site

Direitos Autorais © 2026. Feito com ♥ por Scribe

— Se isso tornou sua vida mais fácil (ou pelo menos um pouco menos caótica), deixe-nos uma avaliação! Prometemos que vai alegrar nosso dia. 😊

Related Videos

Learn to Code in UE5 - 6 - Using Arrays

Video thumbnail
27.57k3,705 Palavras18m readGrade 18
Compartilhar
Channel
Coqui Games
[Music] hello everyone and welcome back to the course in this lesson we'll learn about arrays what they are and how we can use them so let's get started so before we jump into unreal let's first understand what an array actually is arrays are a collection of items stored at contiguous memory locations in simple terms an array is a list of variables of the same type that contain the same name for example we may want to store a list of all of the keys a player has collected but instead of creating one variable per key we can instead create a list of variables that represent all the keys collected by the player besides making our code more organized arrays come with many more benefits over having individual variables arrays don't have a predetermined entry limit meaning you can add or remove entries freely and the size or length of the array can vary even during gameplay you can also search arrays to verify if a certain entry exists or to get a specific value arrays even come with some very useful functionality besides storing our data like the ability to get a random value from the list now this may sound a bit complicated but it's actually quite simple let's go back to unreal and see how this is actually done before we go back to our blueprint let's go ahead and remove one of the instances of our blueprint in our level so go ahead and select one and hit delete now let's go back to our blueprint so now let's create a new variable that will serve as our array click on the plus sign give your variable a name now let's go to the details panel and under variable type let's select string go ahead and compile and as expected we have a field here where we can enter our default value however we want to convert this variable into an array so we simply go to the icon next to the variable type and you can see that we have several options we have single which is the variable type we've been using a single value we have array we have set and we have map for this lesson we're going to look at the array so go ahead and click array and compile again now we see that we have under default value a list of elements right now the list is empty so go ahead and click on the plus sign and you'll see that we have a new index index 0 with a field here you can add as many elements to the array as you want by simply clicking on the plus sign let's go ahead and enter three values here when you're done click on file and save as you can see we have three different strings that are part of the same array called my array index 0 koki games index 1 unreal engine index 2 epic games so now let's take a look at how we can get a value from our array so say that we wanted to display one of these values as we've done on a previous lesson so same thing as before we simply drag our variable and here we'll select get my array you'll notice that the pin is a little bit different the icon is different so when you drag from the pin simply search for get and you'll notice that we have two different options get a copy and get a reference for this example you can get either one get a copy will create a separate copy which means that whatever changes we make to that element will not affect the original array or we can get a reference which means that any changes will affect the array for this example you can select either one it won't make a difference now notice that this node has a get and has a number here this number refers to the index of our array so if we click on our variable reference and go back here we see that we have index 0 1 and 2. so if we want to display index 0 we simply leave the number here as 0. so let's go ahead and do it as before use the print string node and in this case simply connect our get node to the in string node here and click on the arrow and let's make the duration a little bit longer so it's easier for us to see make it five seconds and now compile and let's go back to our map here click on the three little dots on the menu here and select simulate notice on the left hand corner that we see cokie games let's go ahead and stop let's go back to our blueprint and let's change the index to let's say index 1 compile again and let's hit simulate as expected now we see unreal engine let's go ahead and stop and once again go back to our blueprint so what if we wanted to add items to our array in code we have three different items let's say we wanted to add a fourth one that'll be very easy so let's go ahead and disconnect and move our nodes somewhere else drag our variable into the event graph and here we'll simply drag and look for add and notice that we have two different options for add we have add and add unique add will simply add a new element to the array at the end of our list and add unique will attempt to add an item but only if that item doesn't already exist let's take a look at both click on add first and we're going to connect the execution pin and then from here we'll go ahead and connect it to our print string so let's add a fourth item and let's simply add coding in this example and then we'll use our previous node to display the new index in this case the new index will be 3 so we can simply add the number three compile let's go back to our map click simulate and notice that we have the word coding let's go ahead and stop and go back to our blueprint [Music] let's simply duplicate these nodes ctrl c ctrl v connect them as expected and now let's go ahead and change the index here to four [Music] let's go back to our map and click simulate and again we see the word coding go ahead and stop the simulation and let's do something a little different let's go back to our blueprint and make our variable public by clicking on the eye icon here click on compile and now when we go back to our map if we select our instance notice here now on the details panel we have the variable visible and if we expand it we can see that right now we have the three different items let's keep an eye on on this list here and see what happens when we click simulate notice that we have two new items in index three and four both coding again as expected because we added the new string twice let's go ahead and stop the simulation go back to our blueprint in this case what we'll do is we are simply going to replace the add node with add unique [Music] and now let's go back to our map and click simulate notice that the word coding was only added once at index 3.
that is because when we attempted to add it again the add unique node searched for the array and noticed that we already had that entry and decided not to add it that is very useful because a lot of the times you will want to keep your array with unique items or sometimes you just want to add as many items as possible even if they're not unique so in this case you have both options there's one more thing that we want to do when it comes to adding new items and it is a new node called insert so go ahead and drag your array variable into the graph and search for insert go ahead and remove this and connect our insert node here you'll notice that we have a pin for the string we want to insert but also an index value so let's go ahead and add coding as before but now instead of adding this item at the end of the array we can simply select the index so let's say that we wanted to add it on index one and for this example let's actually leave this as index three now let's compile and go back to our map let's keep an eye on the array here yet again when we click on simulate [Music] notice that our new item was added on index 1 in between koki games and unreal engine so we have the ability to add new items to our array in any specific index and all the other indexes will simply be bumped up or down based on our entry very useful if you want to have specific items in a specific location in your array let's go ahead and stop the simulation and go back to our blueprint now let's take a look at what we can do if we want to remove an item from our array so let's go back here and remove this node and drag and search for remove you'll notice we have two different options remove index and remove item select remove index and this node will remove any item on the specified index so if we click on our variable here we'll see that index zero is koki games so if we were to compile and go back to our map click on simulate and notice what happens here on the right hand side index 0 is removed and index 1 and 2 are bumped down in the array let's go ahead and go back to our blueprint if we wanted to remove a specific item we can do it as well so let's remove this node and search for remove again this time let's pick remove item notice that now we have an actual string so let's click on our array and let's simply select one of the values in this case i'll select unreal engine so ctrl c and now ctrl v compile and let's go back to our map and once again let's keep an eye on the array here and click simulate notice how index 1 which had unreal engine has now been removed stop the simulation go back to our blueprint this node has a boolean pin that tells you whether the item was actually removed or not in other words if you wanted to know if the item was found and removed this spin will return true and finally there's one more thing that we want to look at and that is the option of clearing or removing all items from the array so drag and search and look for clear this node will do exactly what it says it will clear the array of all of its items so let's go ahead and click on compile go back to our map and again let's take a look at our variable here and click simulate all of the items have now been removed let's go ahead and stop our simulation and go back to our blueprint this is extremely useful because sometimes you want to hold a certain amount of items in an array temporarily and then you want to reset the array all right so what if we wanted to search the array we can do that as well go ahead and remove the clear node and drag and search and the first thing we'll look at is the contains item node select it and you'll see that it simply has a pin and a boolean at the end this will simply return true or false to the question is does this array contain this item so let's say that i wanted to verify that we have epic games as part of our array i can simply add epic games and now we're going to connect our boolean to the print string node and connect our begin play to print string let's go ahead and compile and let's go back to our map if we click on simulate notice that we have a value of true we have found the item and the note simply tells us that we did if we simply modify this let's say that we add another character compile again let's go back to our map and click simulate notice that now we get a false that value was not found in the array stop go back to your blueprint this is a very useful note again when we're looking at writing logic that depends on whether we have specific items in an array we will use this node quite a lot go ahead and delete it the other one is simply called find item let's go ahead and click it and in this case we will once again include the item name but this node will return the index of the array and as you can see on the tooltip if the item is not found it will return a negative one so let's go ahead and type epic games and let's connect our integer into our string compile let's go back to our map and click on simulate and it returns to the number two that corresponds to the index two of our array and just for testing purposes let's go ahead and misspell epic games by adding a few more characters compile let's go back to our map and click simulate and you can see that we have a negative one because the item wasn't found stop let's go back to our blueprint these two notes are going to be extremely useful when we're trying to find out if a certain item is actually in one of our arrays the next two nodes are quite useful because sometimes we want to just know the size of the array or how many items are actually inside our array and we can do that easily so let's go ahead and remove these nodes and drag from here and search for length select it the array length is the number of items contained within the array so let's go ahead and connect this to our print string compile let's go back to our map and click on seemingly we see the number three we have three different items inside our array notice though that that is different from the index of our array because our array always starts with index zero now let's go back to our blueprint so stop the simulation and go back now let's look at the other node called last index this node will give us the last index over array so let's go ahead and replace the pin here and compile let's go back to our map and click simulate notice the number now is two that corresponds to the actual index of our array the last index of our array is index 2 but the last item or the length of the array the number of items is 3. let's go ahead and stop the simulation and go back these nodes are yet again very useful when you're looking at logic and trying to figure out how many items you have in the array sometimes you want to validate that we have items in the array before we can do certain operations and we also have nodes for that so let's go ahead and remove these nodes here and the first node we'll look at is called is empty and as you can see we have two different options is empty and is not empty go ahead and select the top one here and this will simply return a boolean in other words it's going to answer whether it's true or false whether our array is empty or not so let's connect our boolean to our string compile and let's go back to our map and click simulate false as we can see here because our array indeed has items so it is not empty if you wanted to do the opposite we could use the other node is not empty and that would obviously return true there's another useful node though where we can validate a specific index so drag and search and look for is valid index go ahead and select it and this will also return a boolean but we'll simply answer the question is the index specified here valid so if we select on our node here we see that we have index 0 1 and 2. if we were to leave it at 0 and compile go back and simulate this will return true index 0 is actually valid stop the simulation and go back if we were to change this to some other number say 10 and compile go back to your map and click simulate you will always see obviously that it is false we don't have an index 10.
Vídeos relacionados
Learn to Code in UE5 - 7 - Code Execution Flow
27:14
Learn to Code in UE5 - 7 - Code Execution ...
Coqui Games
20,183 views
Elon Musk sends message to Republicans: This should NOT pass
7:57
Elon Musk sends message to Republicans: Th...
Fox News
444,425 views
Learn to Code in UE5 - 11 - Smooth Movement
36:12
Learn to Code in UE5 - 11 - Smooth Movement
Coqui Games
15,137 views
UE Blueprint Fundamentals | Class #2-1 | Variables : Array & Maps
27:41
UE Blueprint Fundamentals | Class #2-1 | V...
Ask A Dev
14,542 views
Learn to Code in UE5 - 16 - Traces
32:21
Learn to Code in UE5 - 16 - Traces
Coqui Games
6,273 views
Learn to Code in UE5  - 13 - Direct Actor Communication
36:45
Learn to Code in UE5 - 13 - Direct Actor ...
Coqui Games
11,815 views
Russia detains Uzbek national over bomb assassination of senior general
8:58
Russia detains Uzbek national over bomb as...
CNN
54,313 views
The Most Common Mistake Beginners Make in Unreal Engine | UE5
12:17
The Most Common Mistake Beginners Make in ...
Ali Elzoheiry
130,031 views
I Struggled With Blueprint Interfaces for Years!! (Unreal Engine 5)
16:48
I Struggled With Blueprint Interfaces for ...
Glass Hand Studios
194,081 views
Simon Sinek's Advice Will Leave You SPEECHLESS 2.0 (MUST WATCH)
20:43
Simon Sinek's Advice Will Leave You SPEECH...
Alpha Leaders
591,316 views
Putin’s fate hangs in the balance after ‘colossal’ military losses
17:27
Putin’s fate hangs in the balance after ‘c...
Times Radio
206,338 views
Unreal Engine 5 – Full Course for Beginners
11:23:26
Unreal Engine 5 – Full Course for Beginners
freeCodeCamp.org
1,447,853 views
Learn to Code in UE5 - 15 - Event Dispatchers
18:17
Learn to Code in UE5 - 15 - Event Dispatchers
Coqui Games
6,427 views
Learn to Code in UE5 - 4 - Using the Event Graph
15:19
Learn to Code in UE5 - 4 - Using the Event...
Coqui Games
29,395 views
Learn to Code in UE5 - 17 - Custom Actor Components
34:02
Learn to Code in UE5 - 17 - Custom Actor C...
Coqui Games
7,236 views
Unreal Engine Blueprint Fundamentals | Class #5 | For Loops & Arrays
34:26
Unreal Engine Blueprint Fundamentals | Cla...
Ask A Dev
9,576 views
How to...Use Arrays in Unreal Engine 5
10:20
How to...Use Arrays in Unreal Engine 5
Ryan Laley
12,533 views
Unreal Engine Materials in 6 Levels of Complexity
44:12
Unreal Engine Materials in 6 Levels of Com...
pwnisher
317,984 views
Learn Unity DOTS! (FREE Tutorial Course)
7:24:05
Learn Unity DOTS! (FREE Tutorial Course)
Code Monkey
28,767 views
Learn to Code in UE5 - 18 - Putting It All Together
22:05
Learn to Code in UE5 - 18 - Putting It All...
Coqui Games
7,061 views