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"

Set instance variables values as class default

Hi all,

I've got a map generation blueprint that I can just drag into the world and edit to create a grid based map. By creating children of this blueprint, I was hoping to be able to drag them in and edit them in editor and have the variables be saved in the child blueprint. But then I realised that variables of an instance are different from the default class ones.

Is there any way to update a blueprint's default variables from an instanced version of it, the same way we would update a prefab in unity?

Product Version: UE 4.20
more ▼

asked Nov 12 '18 at 03:18 PM in Blueprint Scripting

avatar image

8 4 5 11

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

1 answer: sort voted first

I don't know how things work in Unity, but if you make variables to be instance editable

Instance Editable

You will have access to them in the world outliner, that way you will be able to set values on a per-level basis.

World Outliner

If you plan on spawning them via blueprint into your level make sure that it's exposed to spawn, that way you will be able to set those values when you call the spawn function on that particular child.

capture2.png (11.1 kB)
capture3.png (79.6 kB)
more ▼

answered Nov 12 '18 at 09:56 PM

avatar image

1.2k 31 8 33

avatar image Gamji Nov 13 '18 at 05:05 PM

So that's what I've been doing, because I made it to be some sort of level design tool, anyone using will need to be able to do a lot of tweaks and quick changes, and given that there's quite a few variables to set, doing so from the blueprint, compiling and then checking the result is just to unpractical.

Per example in your screenshot, would it be possible to save the value of "Holo Mat" as the default for BP_HoloController without opening the blueprint and manually set it as the default value ?

avatar image Ego Studio Nov 13 '18 at 05:19 PM

I don't know much about Unity neither but I just read about Prefab and it sound like interesting. Why don't you send a feature request to UE.

avatar image Gamji Nov 13 '18 at 06:21 PM

I might actually, feels weird to be the only one having this issue tho aha!

I'm not that experienced in Unity, but from what I gathered an instanced prefab (kinda the equivalent to an actor class) can be modified via the viewport and you can apply those changes to the prefab class. Although it doesn't change the default values set in code, they are saved in that prefab meaning that if you were to delete the instance and create a new one, it'll still have all the values you've set.

avatar image MajinSephiroth Nov 15 '18 at 04:13 PM

Not sure what the reasoning would be to modify defaults outside of the blueprint editor, I personally don't see value in it. From a programming standpoint, you create default values when you anticipate them not to require changing on the fly. Children inherit the default values and can be individually set to their own defaults as well.

Maybe child blueprints are what you're looking for.

In the example that I gave above, if I create a child of BP_HoloController and modify the HoloMat on the BP_HoloController_Child then they will each have their own individual defaults while having the same functionality.

Wanting to modify the defaults and saving those defaults without editing the blueprint seems kind of an odd practice in my opinion.

avatar image Gamji Nov 26 '18 at 01:01 PM

It simply eases the tweaking of the variables. So for a child blueprint, instead of opening it, changing the values, compiling and then pressing play, you'd just need to select the instance, change the variable in the details panel and pressing play. Those values would then be applied to the child's defaults ones.

It's not something that is absolutely necessary but i feel it would help people like me who are building maps from a class in editor, meaning that compile times takes a bit longer than your typical blueprint.

avatar image MajinSephiroth Nov 26 '18 at 07:31 PM

If all you need is modifying variables after having it placed in level it's already available by default. Taking into consideration the aforementioned example of BP_HoloController, if you drag two instances into the world, you can select them individually in the level and make one have a HoloPeriod of 10 while the other have a HoloPeriod of 12. This does not require you to save and re-compile a blueprint. From that point onwards you can just copy and paste them in your level with the new values.

(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