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"

CollectArea is null when press pickup


I adapt the PowerUp tutorial to my need.

I drop a C++ actor directly on my level (I don't use the Blueprint currently) and I add to the actor a box component to check overlapping actors

 UE_LOG(LogClass, Log, TEXT("Create pickable area"));
 PickableArea = CreateDefaultSubobject<UBoxComponent>(TEXT("PickableArea"));
 FVector boxInitSize(50.f, 90.f, 100.f);

PickableArea is correctly initialized inside the constructor. When I press the key to my action

 void AHandballPlayerActor::PickTheBall()
      if (PickableArea != NULL) {
      } else {
          UE_LOG(LogClass, Log, TEXT("Invalid pickable area")

I always go in the else code. The PickupArea becomes NULL and I don't use any code that assing PickableArea to NULL.

The other actor components are not null (1 SpringArm and 1 Camera).

Any tips?


PS: do you provide the Blueprint/Level data for the PowerUp tutorial?

Product Version: UE 4.10
more ▼

asked Jan 14 '16 at 09:32 PM in C++ Programming

avatar image

6 1 1

avatar image Ryan Darcey Jan 14 '16 at 09:38 PM

Can you set a data breakpoint on the PickableArea variable after it gets initialized?


avatar image knightster Jan 14 '16 at 09:43 PM

I did to check anything. PickableArea is not NULL at the end of the constructor. The constructor is called 3 times when the editor starts.

avatar image Ryan Darcey Jan 14 '16 at 09:49 PM

Right...but if you use a Data Breakpoint (different than normal breakpoint...see link above) the breakpoint will trigger when the variable changes it's data. So, if you manage to set the data breakpoint after the constructor, you'll see where it's getting set to NULL.

avatar image knightster Jan 14 '16 at 10:08 PM

DataBreakpoint give

 void FObjectInitializer::InitProperties(UObject* Obj, UClass* DefaultsClass, UObject* DefaultData, bool bCopyTransientsFromClassDefaults)

when copy element from editor into game object if I understand what is the purpose of UEditorEngine::PlayInEditor and CreatePIEWorldByDuplication

avatar image Ryan Darcey Jan 14 '16 at 10:11 PM

What is the exact line that is setting the value to NULL inside that function?

avatar image Ryan Darcey Jan 14 '16 at 10:12 PM

Also, can you post the line where you declare PickableArea.? I assume it's in the header for your class.

avatar image knightster Jan 14 '16 at 10:13 PM

That's the line 2551. It called CopyCompleteValue that is part of the vcruntime.

avatar image Ryan Darcey Jan 14 '16 at 10:16 PM

hmmm...unfortunately, that throws me past my current knowledge of the engine. not familiar enough with those functions.

avatar image knightster Jan 14 '16 at 10:14 PM
 UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = "Handball", Meta = (BlueprintProtected = "true"))
     UBoxComponent* PickableArea;

 // Accessor to the actor box pick
 FORCEINLINE class UBoxComponent* GetPickableArea() const { return PickableArea; }
avatar image knightster Jan 14 '16 at 10:28 PM

Ok I change the BlueprintReadWrite to BlueprintReadOnly and now it's still reset to NULL but later

  >    UE4Editor-CoreUObject.dll!UObjectProperty::SetObjectPropertyValue(void * PropertyValueAddress, UObject * Value) Line 66    C++
  UE4Editor-CoreUObject.dll!UObjectProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 38    C++
  UE4Editor-CoreUObject.dll!FPropertyTag::SerializeTaggedProperty(FArchive & Ar, UProperty * Property, unsigned char * Value, unsigned char * Defaults) Line 145    C++
  UE4Editor-CoreUObject.dll!UStruct::SerializeTaggedProperties(FArchive & Ar, unsigned char * Data, UStruct * DefaultsStruct, unsigned char * Defaults, const UObject * BreakRecursionIfFullyLoad) Line 1320    C++
  UE4Editor-CoreUObject.dll!UObject::SerializeScriptProperties(FArchive & Ar) Line 982    C++
  UE4Editor-CoreUObject.dll!UObject::Serialize(FArchive & Ar) Line 926    C++
  UE4Editor-CoreUObject.dll!StaticDuplicateObjectEx(FObjectDuplicationParameters & Parameters) Line 1655    C++
  UE4Editor-CoreUObject.dll!StaticDuplicateObject(const UObject * SourceObject, UObject * DestOuter, const wchar_t * DestName, EObjectFlags FlagMask, UClass * DestClass, EDuplicateForPie DuplicateForPIE) Line 1553    C++
  UE4Editor-UnrealEd.dll!UEditorEngine::CreatePIEWorldByDuplication(FWorldContext & WorldContext, UWorld * InWorld, FString & PlayWorldMapName) Line 3456    C++
  UE4Editor-Engine.dll!UGameInstance::InitializePIE(bool bAnyBlueprintErrors, int PIEInstance) Line 150    C++
  UE4Editor-UnrealEd.dll!UEditorEngine::CreatePIEGameInstance(int PIEInstance, bool bInSimulateInEditor, bool bAnyBlueprintErrors, bool bStartInSpectatorMode, bool bRunAsDedicated, float PIEStartTime) Line 2676    C++
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I answer my question by removing the c++ actor from the level. After I inherit a BP actor from my c++ actor, I was able to use the Pickable area.

Don't know why it is not possible to use the c++ actor. So fixed by using a BP class.

more ▼

answered Jan 17 '16 at 10:59 AM

avatar image

6 1 1

(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