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"

Is there a way to 'reset' a blueprint and it's variables to the starting state?

Lets say I have a blueprint that modifies a bunch of it's variables based on input. Is there a way to trigger a 'reset' that places all those variables back in their default state without destroying and respawning the blueprint itself?

Product Version: Not Selected
Tags:
more ▼

asked Aug 01 '14 at 05:18 PM in Blueprint Scripting

avatar image

Hyperloop
1.2k 57 67 97

avatar image Jacky Aug 01 '14 at 05:22 PM

You can Set those variables with an event to the value you like. How you set it up depends on your BP network of course.

avatar image Hyperloop Aug 01 '14 at 05:31 PM

If I'm understanding you correctly, that would mean I'd need to store the initial (default) state of the variable someplace, correct? I think this would work of course. I was just curious if there was a method of re-setting a variable to it's default value without needing to store that value separately.

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

You can grab the values from the default object if that suites you.

Here's a little helper function in C++ to get the default

HPP

 UCLASS()
 class UMiscUtilities : public UBlueprintFunctionLibrary
 {
     GENERATED_UCLASS_BODY()

     UFUNCTION(BlueprintPure, meta = (FriendlyName = "GetDefaultObject", CompactNodeTitle = "Default", Keywords = "get default object"), Category = "Misc|Utilities")
     static UObject* GetDefaultObject(UClass* InClass);
 };

CPP

 UObject* UMiscUtilities::GetDefaultObject(UClass* InClass)
 {
     if (!InClass)
         return nullptr;
 
     return InClass->GetDefaultObject();
 }
more ▼

answered Aug 01 '14 at 05:28 PM

avatar image

Grogger
780 49 58 93

avatar image Hyperloop Aug 01 '14 at 05:36 PM

Oh, that's handy. Grogger, thank you for posting this.

(comments are locked)
10|2000 characters needed characters left

Simply create your own (function) to reset variables, if you don't know the default values for your variables, then just create new set of (duplicate) variables and when the game starts save the initial values to them so you can use them as reference for resetting. Then you need to figure out at what event you will want to reset those variables. btw: You can reset your level with Console Command "Reset" or "Restart"I think.

more ▼

answered Aug 01 '14 at 05:37 PM

avatar image

Jurif
637 25 15 44

(comments are locked)
10|2000 characters needed characters left
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