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"

Proper way to check if an object is valid

I want to check if an object (UAudioComponent*) is valid so I can remove it from my array because the sound finished and the UAudioComponent will be destroyed, but when I use IsValid function it return

"Assertion failed: Index >= 0 [File:C:\Program Files\Epic Games\UE_4.22\Engine\Source\Runtime\CoreUObject\Public\UObject/UObjectArray.h] [Line: 661]

UE4Editor.exe has triggered a breakpoint."

because when the isValid function check if it is pending to kill, then access to an invalid index, so which is the best way to check if an object is valid or not? I will put pictures of the problem down there.alt textalt textalt textalt text

Product Version: UE 4.22
Tags:
untitled9.png (55.8 kB)
untitle10d.png (42.2 kB)
untitle11d.png (55.0 kB)
untitle12d.png (84.2 kB)
more ▼

asked Jul 17 '19 at 09:21 AM in C++ Programming

avatar image

YamikaDesu
14 2 1 3

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

1 answer: sort voted first

I use Object->IsValidLowLevel()

You can also do a c++ nullptr check to see if it is able to be accessed.

more ▼

answered Jul 17 '19 at 10:40 AM

avatar image

HarryHighDef
1.4k 2 14 17

(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