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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Crash after changing C++ from Actor to Component

Hey guys,

I wanted to Report a bug:

When I create a Class which derives from AActor and place it in the World and Change this Actor afterwards to a USceneComponent the Engine crashes and doesn't load the map anymore.

The Crash is in the Level.cpp (Line 762) where the AttachedDepth is calculated.

 StableSortInternal(Actors.GetData(), Actors.Num(), [&](AActor* L, AActor* R) {
         return CalcAttachDepth(L) < CalcAttachDepth(R);
 });

I debugged this and saw that L is my previous Actor which is now a SceneComponent

Product Version: UE 4.11
Tags:
more ▼

asked May 25 '16 at 09:50 AM in C++ Programming

avatar image

Cloudy McStrife
465 13 15 38

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

1 answer: sort voted first

Hey Cloudy McStrife-

Components alone are not meant to be added to the viewport. The crash is occurring when the level attempts to process the "actor" that was placed but can't recognize it. Changing the type of a class (Actor, Character, SceneComponent, etc.) after creating it is not a supported workflow. If you change the class back to Actor, you should be able to open the map again.

Cheers

Doug Wilson

more ▼

answered May 25 '16 at 06:53 PM

avatar image Cloudy McStrife May 27 '16 at 11:00 AM

Hey Doug, yes I know. But I would say that the Engine should make sure that IF a component is placed in world 1. that Component should be deleted. or 2. that Component should be wrapped into an Empty Actor as a Child of his RootComponent

The Problem in my case is that changing the Component back to an Actor would take some time because this Component is a BaseClass of many other COmponents :P

Thanks for you answer

avatar image Doug E ♦♦ STAFF May 27 '16 at 01:19 PM

The editor already protects against components in the world by preventing the ability to add them directly. This workflow is a workaround to this protection which the editor responds with by closing. If converting the component class to an actor is not an option, you could create a new class with the functionality of your component class. If you reparent the other components, at least temporarily, to this new class, you should then be able to remove/edit the original.

avatar image Cloudy McStrife May 30 '16 at 07:35 AM

Thanks for you help Doug,

but in my opinion it's still a bug. I just wanted to help you guys :)

(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