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"

AnswerHub Maintenance

Background maintenance is scheduled to occur between 9 - 11am EDT on Tuesday, May 21. Site operation may be slower than normal during this time and a brief interruption in operation may be observed

Variable loses value after ToText

Not sure i understand this one. I've seen a few other similar posts but no answer seems to work for me.

alt text

any ideas why my variable has a value but after ToText is called the value is lost?

Product Version: UE 4.20
Tags:
blueprint.png (436.5 kB)
more ▼

asked Sep 04 '18 at 11:54 PM in Blueprint Scripting

avatar image

jimmyt1988
63 5 12 13

avatar image dZh0 Sep 05 '18 at 11:44 AM

Are you sure? Breakpoints cut the execution before the node they are on is executed.

Can you "Step Over" and see if the value is filled?

Can you also show the watched variables in the "Blueprint Debugger" tab as (for me) the bubbles are hard to track.

I suspect that the "ToText (string)" node does not return a proper value from the screenshot but I'll have to try it.

avatar image jimmyt1988 Sep 06 '18 at 08:33 PM

Well. I'm getting "Variable not in scope" error on the image and totext part.

avatar image jimmyt1988 Sep 06 '18 at 08:51 PM

Oh how silly of me. I was deleting the object while this was all happening... That's why half way through it loses reference. MAtttt Daemmonnnn

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

1 answer: sort voted first

I was deleting the object:

 void AInteractiveActor::PickUp_Implementation(AActor* item)
 {
     if (item->GetClass()->ImplementsInterface(UInteractiveItem::StaticClass()))
     {
         IInteractiveItem* interactiveItem = Cast<IInteractiveItem>(item);
         if (AInventoryItem* inventoryItem = Cast<AInventoryItem>(interactiveItem))
         {
             APlayerPawnController* playerPawnController = Cast<APlayerPawnController>(GetWorld()->GetFirstPlayerController());
             playerPawnController->PlayerPawn->Inventory->InventoryItems.Add(Cast<AInventoryItem>(inventoryItem));
             //item->Destroy();
             playerPawnController->HideActionsMenu();
             playerPawnController->ShowInventory(inventoryItem);
         }
     }
 }

so half way through the blueprint running, the ref was removed. Clever me :)

more ▼

answered Sep 06 '18 at 08:52 PM

avatar image

jimmyt1988
63 5 12 13

(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