Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Blueprints Q] Best way to reference all static meshes in a level?

I'm trying to hide / show all Static Meshes in a particular level for multiple levels. My logic decides which one(s) should currently be visible ingame.

Previously in UE3 you could set an entire level to be visible / invisible. However you can't in UE4 so I'm trying to add Static Meshes to arrays specific to their levels. I can't find a way of finding out which level a particular Static Mesh is in though. If I use the 'Get All Actors Of Class' node it will get all Actors in all levels, not just the current level.

I'd prefer not to have to add a reference to every individual mesh in each level graph and maintain that list as meshes are deleted & added.

Any ideas on how to achieve t his?

Product Version: Not Selected
more ▼

asked Mar 25 '15 at 11:04 AM in Blueprint Scripting

avatar image

66 11 16 23

avatar image alperenakyuz Mar 25 '15 at 11:09 AM

In a blueprint you would use get all components of type, but I'm not sure if it is possible for the level blueprint.

avatar image Jimmy_Jazz Mar 25 '15 at 11:12 AM

That's what I've done already, but as you say, it doesn't include any level information :(

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

If you spawn your enemies in code you can easily add a variable to each instance that tells what level it is part of, that way you can get all actors of class and compare this variable to whatever level you're interested in.

It's not pretty but it'd work. Making the same variable public would work too if you place your enemies manually.

If you have code that uses an 'open level' command you can store this variable as well and use it when the actors are spawned.

I'm not aware of any other solution but there might be, it'd be easier than maintaining a list of actor references at least! :)

more ▼

answered Mar 25 '15 at 03:38 PM

avatar image

206 11 18 19

avatar image Jimmy_Jazz Mar 25 '15 at 04:05 PM

Unfortunately I'm using Blueprints only and dealing with Static Meshes, not enemies.

I'd like to know if it's intention or oversight that stops devs from accessing level information relating to pawns within BPs.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

I don't know if you still need an answer for this, but you can use World composition to split all your actors,meshs and everything up by "level, then simply make each level of objects visible or hidden (or unloaded/loaded). Just pick a level, go to world settings and click enable world composition, and it will add the other levels to your scene. then using blueprints you can choose when to load or unload huge sections at a time.

In my level I have two versions of the same map and by pressing a button i can unload and load entire levels of different meshes, while my character stays in the same place.

Reply to this if you want me to go into more detail, if you still need a solution.

more ▼

answered Aug 27 '15 at 02:10 PM

avatar image

13 5 9 13

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question