<track id="5sipw"><track id="5sipw"><span id="5sipw"></span></track></track><delect id="5sipw"></delect>

<meter id="5sipw"></meter>

  • <meter id="5sipw"><ins id="5sipw"><strike id="5sipw"></strike></ins></meter><nobr id="5sipw"><input id="5sipw"><ruby id="5sipw"></ruby></input></nobr>

      1. <cite id="5sipw"></cite>

          Finding Actors

          A How To Guide for Finding Actors in your Scenes in Unreal Engine 4.

          Windows
          MacOS
          Linux
          On this page

          Once you start constructing your game and its levels, you may find that locating an individual Actor in your scene may be difficult. It is not uncommon to have hundreds of Actors in your scene ranging from level set pieces or geometry, to NPCs or enemies, to interactable objects or pick-ups and locating one Actor out of all those is like the old saying of "looking for a needle in a haystack".

          You can however use the World Outliner to help narrow your search for an Actor in your scene (pictured below).

          Actors1.png

          In the image above, the World Outliner (right) represents all the Actors that are placed inside your level. Clicking on one of the Actors in the World Outliner highlights it inside the level viewport as well. You can sort the World Outliner by Actor Name or by Actor Type by clicking on the Actor or Type headers (you can change the secondary category from Type to other filters by clicking the down arrow in the Type Box).

          With an Actor selected in the World Outliner, and while navigating inside the Level Viewport, pressing the F key will move the camera to the location of the Actor selected to Focus on it.

          Refer to the World Outliner documentation for more information on locating an Actor in your scenes.

          While finding an Actor in the Editor can be accomplished with the help of the World Outliner, how do you go about finding an Actor through Blueprints so that you may modify it in some way? This "How To" series will show you some ways in which you can search your scene for an Actor based on varying criteria at which point you can then access and modify it if you wish.

          Implementation Guide

          On this page

          This page covers examples on how to find Actors in a level by using the Get All Actors of Class node. This node when called will retrieve all Actors in your level of the specified Class and place them in an Array (collection of variables) and from that Array, you can pull out all Actors or individual Actors based on criteria you wish to filter by. You can then access the properties of the Actor(s) or modify them in some way based on the type of Actor it is and what you wish to achieve.

          Get All Actors of Class

          For this example, we are using the Blueprint Third Person Template with Starter Content.

          1. Inside the Content Browser under Game/Blueprints, drag in three Blueprint_Effect_Fire assets.

            Actors1.png

            Place them where ever you wish, we are simply adding these as the item to attempt to find.

          2. In the Content Browser under the Game/Blueprints folder, open the MyCharacter asset.

          3. In the graph of the Blueprint Editor Window, Right-click and add the F Key Event.

            Actors2.png

            When pressing F, we will attempt to locate the Actors in the scene.

          4. Off the Pressed pin of the F Key Event, add the Get All Actors Of Class node.

            Actors3.png

            This will attempt to do as the name implies and get all the Actors of the specified class.

          5. In the Get All Actors of Class node, click the Actor Class drop-down and add the Blueprint_Effect_Fire class.

            Actors4.png

          6. Drag off the Out Actors and add a ForEachLoop node.

            Actors5.png

            The Out Actors is an Array of all the Actors (of the Class specified) and "For Each" of them we can do something.

          7. Drag off the Array Element of the ForEachLoop node and get P_Fire and Fire Audio.

          8. Right-click in the graph and add a Deactivate node, then connect the fire and audio pins to the Target.

            Click image for full view.

            Here we are saying when the player presses F, we will get all instances of the fire effect in the level and deactivate them.

          9. Click the Compile button, then close the Blueprint and click Play to play in the Editor.

          You should be able to deactivate all instances of fire that you have placed in your level by pressing the F key.

          Using this method, we were able to find all Actors of a particular Class and affect them in some way, but what if you want to find all Actors of a particular Class and then find a set of Actors or a specific Actor within that Class and modify it instead of all of the Actors of that Class? The next section will show you some methods you can take to apply filters to your resulting Array and only get the one(s) you want from it instead of all of them.

          Get Specific Actors

          In the previous section, we learned that using the Get All Actors of Class node produces an Array of Actors of the specified Class. This section will show you how you can filter the Array results based on different criteria to get specific Actors or a single Actor from the Array.

          One method you can take is by using Tags on the Actor, for example:

          1. Continuing from the example in the previous section, select one of the fire effects in your level.

          2. In the Details panel, find the Tags section and click the plus sign to add a tag to the Actor.

            Actors8.png

          3. In the 0 field, enter some text such as Target for the tag.

            Actors9.png

          4. Inside the MyCharacter Blueprint, drag off the Array Element of the ForEachLoop and add the Get Tags node.

            Actors10.png

          5. Off the Tags pin, add a Get node.

            Actors11.png

            Here we are "Getting" the Tag at Index 0 (which we set as Target above).

          6. Right-click in the graph and add a Branch node.

          7. Drag off the Condition of the Branch and add an Actor Has Tag node.

          8. Connect the out pin from the Get node to the Tag pin on the Actor Has Tag node.

          9. Connect the Array Element of the ForEachLoop pin to the Target pin on the Actor Has Tag node.

            Actors12.png

          10. Drag off the Array Element of the ForEachLoop pin to get P_Fire and Fire Audio and connect them to a Deactivate node.

            Click image for full view.

            Here we are stating that after we have collected all Actors of the Class specified and put them in an Array, we then check each Actor to see if it has the Tag we specified and ONLY if it does, we deactivate it.

          Here is another example of filtering results:

          Click image for full view.

          In the example above, we are getting all Actors of the Emitter Class and not a specific Class of Blueprint (this could be used in the event that you have several emitters in your level such as smoke, fire, wind, rain, fog, etc. and you want to turn them all off). We are Casting to an Emitter Object then checking if the Emitter is Active and if so, deactivating it.

          You do not always need to Cast to an Object following the ForEachLoop, take the example below:

          Click image for full view.

          Here we are getting all Actors in our level of the Class TriggerBox and disabling collision on them (turning off all triggers in the level). We did not need to Cast To a TriggerBox as we are not accessing Components of the TriggerBox but the TriggerBox Actor itself. Whenever you want to access the Components that comprise the Actor, that is when you would want to use the Cast To node.

          Select Skin
          Light
          Dark

          Welcome to the new Unreal Engine 4 Documentation site!

          We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

          We'll be sure to let you know when the new system is up and running.

          Post Feedback
          网上捕鱼平台