x

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"

Best way to store actor reference(s) in variable(s) in level blueprint?

How can I store a Static Mesh Actor reference in a (public) variable in my Level Blueprint?

Without initializing them myself this way: Initialize variables on BeginPlay

Because I can't set the default value of a Static Mesh Actor variable in the Blueprint Editor: Setting default value is not allowed

Or if I seem to go the wrong way about this, what would be a better way get these 8 Static Mesh Actor (that are already placed in a level in the editor) as references in variables? I want to have specific references to each of the 8 objects, not as a group, so I can hide/show them individually with my own function?

Product Version: UE 4.15
Tags:
more ▼

asked May 18 '17 at 12:29 PM in Blueprint Scripting

avatar image

n2k
46 5 9 15

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

2 answers: sort voted first

I think I was going about it the wrong way, in the Level Blueprint you don't need to store Static Mesh Actors in variables that already placed in the level. Every time you require a reference you simply select the Actor in the viewport, right-click in the Level Blueprint and click on Create a Reference to "YourActorName". For example: Disable Actors via Reference

In other cases you would need to assign references to variables, for example if you are spawning Actors with blueprints.

more ▼

answered May 30 '17 at 07:47 AM

avatar image

n2k
46 5 9 15

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

This might not be the most code efficient way, but you could assign actor tags to your static mesh actors in the level and then in your blueprints iterate through GetAllActorsWithTag. No storing of variables needed, only that you'll need to call that function each time you want to do some logic with those actors.

more ▼

answered May 19 '17 at 02:37 PM

avatar image

Memorykiller
76 1 2 9

avatar image n2k May 22 '17 at 06:43 AM

Thanks for your response, but I want to have specific references to each of the 8 objects, not as a group. I should've probably included that in the original post :)

(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