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"

My game delegates have broken

Hello We are using UnrealEngine since version 4.1, for our commercial project, right now we are on 4.6.1, we have ONLY used release versions of the engine.

Well, after saying this, I'm going to explain my problem:

One week ago, some of our maps started to giving us problems, lots of the delegates that we used in our level blueprints, are broken and if I try to:

  1. Delete the delegate box, Unreal crashes

  2. Save the map, UnrealCrashes.

  3. Play, UnrealCrashes.

Debugging from visual studio I found the function that crashes on ScriptDelegates.cpp

 void RemoveInternal( const TScriptDelegate<TWeakPtr>& InDelegate ) const
     {
         const int32 NumFunctions = InvocationList.Num();
         for( int32 CurFunctionIndex = 0; CurFunctionIndex < NumFunctions; ++CurFunctionIndex )
         {
             if( InvocationList[ CurFunctionIndex ] == InDelegate )
             {
                 InvocationList.RemoveAtSwap( CurFunctionIndex );
 
                 // No need to continue, as we never allow the same delegate to be bound twice
                     break;
             }
         }
     }


This line crashes: const int32 NumFunctions = InvocationList.Num();

Because InvocationList = NULL

Yesterday we tried to fix this by deleting the actor, and then deleting the delegate (This worked) but, when we restarted the editor, the problem appeared again.

Right now our project is very big, and we can't redo all the maps again (This bug doesn't appear in all maps).

If you need something to track this bug, ask for It, i will help with anything you need to fix this issue.

In this picture you can see where it crashes: alt text

One more thing, some of the delegates that failed in those maps, changed their names from (For example):

OnBeginOverlap(TriggerBox39)

to:

OnBeginOverlap(TriggerBox-1)

Bit if I right click on the delegate and select Find actor in level it takes me to the right actor.

Thanks in advance for your time.

EDIT:

Well, finally I have updated to the last 4.7 version from Github and the problem persists...

If I try to compile the level, the engine crashes in BlueprintEditorUtils,cpp in this function:

 bool FBlueprintEditorUtils::FixLevelScriptActorBindings(ALevelScriptActor* LevelScriptActor, const ULevelScriptBlueprint* ScriptBlueprint)

When it tries to get the target delegate from the event node, the TargetDelegated = NULL, so when it makes the check it crashes...

 // Grab the MC delegate we need to add to
 FMulticastScriptDelegate* TargetDelegate = EventNode->GetTargetDelegate();
 check(TargetDelegate); //<-CRASH

I tried to duplicate the map but it crashes too. The only way I can do something is by deleting the actor first and then I can safely delete the event delegate related to that actor.

I have modifyed this part of the function:

 if( LevelScriptActor->FindFunction(TargetFunction) )
                 {
                     // Grab the MC delegate we need to add to
                     FMulticastScriptDelegate* TargetDelegate = EventNode->GetTargetDelegate();
                     check(TargetDelegate);
 
                     // Create the delegate, and add it if it doesn't already exist
                     FScriptDelegate Delegate;
                     Delegate.BindUFunction(LevelScriptActor, TargetFunction);
                     TargetDelegate->AddUnique(Delegate);
                 }


To this:

  if( LevelScriptActor->FindFunction(TargetFunction) )
     {
         // Grab the MC delegate we need to add to
         FMulticastScriptDelegate* TargetDelegate = EventNode->GetTargetDelegate();
     
         //check(TargetDelegate);
     
         if (TargetDelegate){
           // Create the delegate, and add it if it doesn't already exist
           FScriptDelegate Delegate;
           Delegate.BindUFunction(LevelScriptActor, TargetFunction);
           TargetDelegate->AddUnique(Delegate);
         }
         else{
            FString log = EventNode ? EventNode->GetName() + "(" + EventNode->EventOwner->GetName()+")" : TEXT("unknown");
            UE_LOG(LogBlueprint, Warning, TEXT("TargetDelegate for node %s is = NULL"), *log);
            bWasSuccessful = false;
         }
     }

This fixes nothing but at least I can see wich delegates are broken.

I will try to replace the actors and their delegates to see if they work again .

Product Version: Not Selected
Tags:
error.png (86.2 kB)
more ▼

asked Feb 12 '15 at 12:53 PM in Bug Reports

avatar image

Yannick
26 4 5 6

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

1 answer: sort voted first

Hey Yannick-

Delegate issues have been reported and we are currently investigating what the cause may be and possible solutions. Once there is a solution that does not disrupt other aspects of the engine it will be implemented. For the time being, let us know if replacing the actors and delegates helps you with your project

Cheers

Doug Wilson

more ▼

answered Feb 19 '15 at 07:28 PM

avatar image Yannick Feb 20 '15 at 10:04 AM

Hey, thaks for the answer.

Yes, replacing the actors and created again the delegates seems to fix the problem. The strange thing is that I MUST delete the actor before deleting the delegates or it crashes... (I don't know if this info will help you to find the problem).

Thanks for your time.

(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