Download

Should I really correct every "accessed none" error ?

Hello,

I could solve those errors but it means puting a “is valid” check before lots of things, so it will take away processing power.
So is it realy necessary to solve them ?

What if I let them unsolved ? Will the game crash ?

Likely.
and an Is valid check doesn’t cost enough to justify Not using it.

It’s the same story with doing something half assed vs doing it properly.
just do it properly.

As you project grows, you need to start paying attention to all the signs you can find that things may be going off course.

If you don’t, you may well end up with a great game, but it will be crashing and doing weird things, and you’ll have no idea why.

So it’s always a good idea to sort out this kind of thing.

It might seem like a good idea to valid-check, but it could actually make troubleshooting much more difficult.

To elaborate, here’s a small example. You spawn Something - an object with no visual components to it, and later you want to DoThing() with it. But for whatever reason, Something didn’t spawn.

If you don’t valid check Something before DoThing()
then the game will crash or you’ll get a warning in the editor. This information points to where the problem is. You know that something is wrong and in broad terms what needs fixing.

If you valid check Something before DoThing()
then the check will fail silently and you have no idea why DoThing() didn’t do its thing.
Is it DoThing() that is the problem? Is Something the problem? Where’s the issue occuring? Maybe you don’t even realize it has to do with Something or DoThing() and start looking elsewhere for the cause of the issue.

If you’re getting errors, something is wrong. They should not happen in the first place. But an IsValid() check is not a solution.
IsValid() should be put in with thought, only for things that are allowed to fail silently.

Thank you all for your responses !

I know what causes the errors, it is normal and that should be allowed silently, so I guess I will do an IsValid since it is in the case ste1nar explained :slight_smile:
As a precaution I will add PrintText so that if it fail I know it failed and why :slight_smile:

You could hook up a print string to the “not valid” output. Maybe create a function that handles that type of error where you append the actor id so you can quickly hook that up.

+1 on making something that isn’t a problem a problem
just add a print string or an error print out to the log. Problem solved.