Is there an easy way to output a message if Resources.Load fails to find a resource?

Just for debugging. I don’t really want to insert null checks everywhere or wrap the Resources.Load function if there’s already an in-built method that I’m missing.

Check if the result is null. Pretty sure that’s it. I guess you could try the asset pipeline but you would still be checking if something exists do I don’t understand the aversion to null.

It makes the code messy.It just helps if there’s some sort of flag like a preprocessor that if enabled, unity would output in the console if it couldn’t load a resource.

For example, if I’m loading in a lot of different resources based on an excel sheet, and I’m trying to track down a typo, it’d be great not having to insert if null Console.log everywhere.

Returning null if the resource you are looking for is null kind of makes sense…

But if null checks bother you, simply wrap the call to Resource.Load in its own function with a built in null check and console output.

1 Like