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"

Unreal Editor crashes when adding

Added this Code to the .h:

 public:
     UPROPERTY(VisibleAnywhere)
     float OpenAngle = 90.0f;
     
     UPROPERTY(EditAnywhere)
     ATriggerVolume* PressurePlate;
 
     UPROPERTY(EditAnywhere)
     AActor* ActorThatOpens; //Pawn inherits from actor


and this is the .cpp:

  // Fill out your copyright notice in the Description page of Project Settings.
  
  #include "BuildingGame.h"
  #include "OpenDoor.h"
  
  
  // Sets default values for this component's properties
  UOpenDoor::UOpenDoor()
  {
      // Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
      // off to improve performance if you don't need them.
      PrimaryComponentTick.bCanEverTick = true;
  
      // ...
  }
  
  
  // Called when the game starts
  void UOpenDoor::BeginPlay()
  {
      Super::BeginPlay();
  
      //////////////////////////////////////////////////////////////////////////
  }
  
  void UOpenDoor::OpenDoor()
  {
      AActor* Owner = GetOwner();
  
      FRotator NewRotation = FRotator(0.0f, -160.0f, 0.0f);
  
      Owner->SetActorRotation(NewRotation);
  }
  
  // Called every frame
  void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
  {
      Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
  
      // ...
  
      if (PressurePlate->IsOverlappingActor(ActorThatOpens))
      {
          OpenDoor();
      } 
  }
  

I did set the pressure Plate to the TriggerVolume and added this as component to the Actor (Door). My Goal was to be able to set an actor that opens the door (changes yaw) when it is in the trigger volume.

Can anyone help? I get this Error (UE Editor Crashes):

 Fatal error!
 
 Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000340
 
 UE4Editor-Engine.dll!0x00000000AB8790A1
 UE4Editor-BuildingGame-9929.dll!UOpenDoor::TickComponent() [d:\users\lf\documents\repos\unrealcourse\buildinggame\source\buildinggame\opendoor.cpp:42]
 UE4Editor-Engine.dll!0x00000000ABC2C05F
 UE4Editor-Engine.dll!0x00000000ABC51A15
 UE4Editor-Engine.dll!0x00000000AC7DD9DD
 UE4Editor-Engine.dll!0x00000000AC7E385D
 UE4Editor-Core.dll!0x00000000C09ED84D
 UE4Editor-Core.dll!0x00000000C09EDC6D
 UE4Editor-Core.dll!0x00000000C0A0CCEB
 UE4Editor-Engine.dll!0x00000000AC808861
 UE4Editor-Engine.dll!0x00000000AC819532
 UE4Editor-Engine.dll!0x00000000AC147B64
 UE4Editor-Engine.dll!0x00000000AC1501AD
 UE4Editor-Engine.dll!0x00000000ABF05B17
 UE4Editor.exe!0x000000007A96DEE3
 UE4Editor.exe!0x000000007A95EB40
 UE4Editor.exe!0x000000007A95EBBA
 UE4Editor.exe!0x000000007A970A29
 UE4Editor.exe!0x000000007A9722B6
 KERNEL32.DLL!0x00000000E8692774
 ntdll.dll!0x00000000E8F90D61
 ntdll.dll!0x00000000E8F90D61

EDIT: Changed Error Log Output

Product Version: UE 4.15
Tags:
more ▼

asked Apr 16 '17 at 06:29 PM in Bug Reports

avatar image

Lerrrtaste
3 1 3

avatar image Wurmloch83 Apr 16 '17 at 06:50 PM

The error occurrs in UOpenDoor::BeginPlay() in line 25, please add the function listing to the question.

avatar image Lerrrtaste Apr 16 '17 at 07:08 PM

Sorry had pasted an older error :/, already found out its in the wroing place and moved it to the part which is executed every Frame.

I changed it in the original post

avatar image Lerrrtaste Apr 17 '17 at 01:43 PM

The Code above is all I changed, but here is the whole .cpp file

 :
  // Fill out your copyright notice in the Description page of Project Settings.
  
  #include "BuildingGame.h"
  #include "OpenDoor.h"
  
  
  // Sets default values for this component's properties
  UOpenDoor::UOpenDoor()
  {
      // Set this component to be initialized when the game starts, and to be ticked every frame.  You can turn these features
      // off to improve performance if you don't need them.
      PrimaryComponentTick.bCanEverTick = true;
  
      // ...
  }
  
  
  // Called when the game starts
  void UOpenDoor::BeginPlay()
  {
      Super::BeginPlay();
  
      //////////////////////////////////////////////////////////////////////////
  }
  
  void UOpenDoor::OpenDoor()
  {
      AActor* Owner = GetOwner();
  
      FRotator NewRotation = FRotator(0.0f, -160.0f, 0.0f);
  
      Owner->SetActorRotation(NewRotation);
  }
  
  // Called every frame
  void UOpenDoor::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction)
  {
      Super::TickComponent(DeltaTime, TickType, ThisTickFunction);
  
      // ...
  
      if (PressurePlate->IsOverlappingActor(ActorThatOpens))
      {
          OpenDoor();
      } 
  }

 

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

1 answer: sort voted first

Most probably you PreasurePlate is not (yet) initialized.

  • Either you forgot to initialize it at all (it is not in the code listing in the question),

  • or it is not yet there in the first few ticks (if you initialize it from Blueprint at some time)

If it is the first you need something like this in the constructor:

 PressurePlate = CreateDefaultSubobject<ATriggerVolume>(TEXT("PressurePlate"));

if its the latter, you could change your code:

       if (PressurePlate && PressurePlate->IsOverlappingActor(ActorThatOpens))
       {
           OpenDoor();
       } 




more ▼

answered Apr 16 '17 at 07:20 PM

avatar image

Wurmloch83
586 14 12 37

avatar image Lerrrtaste Apr 17 '17 at 06:39 PM

Thanks, adding the "PressurePlate &&" to the If Statement, fixed it. Could you explain what was wrong? I followed a tutorial, and he didnt said anything about this.

avatar image Wurmloch83 Apr 18 '17 at 05:49 PM

I can only speculate on the cause of the problem. My code fix only addresses the symptom, which is that PressurePlate was nullptr at the time is was accessed (the if (PressurePlate) is similar to if ((PressurePlate != nullptr)).

Because the access occurs in Tick, it could be that it simply has been initialized later than the tick function begins to tick. If this is the case, the proposed fix is fine, although it would be prettier to ensure it to be valid on first tick.

Its also possible that PressurePlate is never initialized. You will know it if OpenDoor() is never called at all.

avatar image Beregron Sep 24 '17 at 05:17 PM

I know this was answered. But i want you to know. The first Thing is the Problem. The Pressure plate was not initaliziesed.

I had the same Problem. The Course for learning c++ in unreal was made with 4.10. Now you have to find some Solutions. BUT: I think this a good practise. Beacuse you learn a lot more.

Cheers

(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