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"

c++ destroy UStaticMesh?

If I need to remove a UStaticMesh from my component, do I NEED to mark it for destruction? Or can I just remove it from my component and leave it for the garbage collector to deal with?

For instance should I do (A):

  if(MyStaticMesh->IsValidLowLevel())
  {
       MyStaticMesh->ConditionalBeginDestroy();
       MyComponent->SetStaticMesh(0);
  }

Or should I just do (B):

 MyComponent->SetStaticMesh(0);



I ask because A seams to crash super frequently, as well as giving me "Failed to Load Asset" errors.

B SEEMS to remove the static mesh as I'd like it to? But I haven't found concrete information telling me it's not still floating around un-cleaned-up.

Product Version: UE 4.8
Tags:
more ▼

asked Jul 29 '15 at 04:18 AM in C++ Programming

avatar image

viperld
20 8 9 12

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

1 answer: sort voted first

With the A method, the Static mesh will be destroyed, and maybe you're setting the mesh when it doesn't exist, so the editor crashes because it can't load the asset. The B method should work fine. If you want to destroy the component, use:

 MyComponent->DestroyComponent()

But you can't use it after it's destroyed!

more ▼

answered Aug 04 '15 at 02:02 PM

avatar image

Scienziatogm
369 44 40 51

(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