NaughtyAttributes icon indicating copy to clipboard operation
NaughtyAttributes copied to clipboard

[Request] Log errors in debug console

Open thibautvdu opened this issue 5 years ago • 4 comments

Description

Log contextualized errors in the debug console for the GUI errors, a bit like what we can achieve with Unity assert and OnValidate in Monobehaviours :

    private void OnValidate()
    {
        UnityEngine.Assertions.Assert.IsNotNull(MySerializedProperty);
    }

Why

It would be very convenient to open a scene and get a reference in the console to all the monobehaviours that do not fulfill the attribute requirements / specifications in the scene

I'd happily do it myself, but some hint/suggestion would be welcomed as I'm not used to work with the Editor that much.

thibautvdu avatar Nov 16 '20 10:11 thibautvdu

What exactly do you want to do? I don't understand you.

dbrizov avatar Dec 22 '20 08:12 dbrizov

@dbrizov

Sorry if I wasn't clear. Basically, I would like to get the errors shown in the inspector in the console when opening / building a scene. Correct me if I'm wrong, but there is no easy way to know whether some monobehaviours fail fulfilling the naughty attributes requirements in the current scene without checking every gameobject manually.

If I have a [required] public MeshRenderer _meshRdr on some monobehaviours attached to a game object in my scene left to null, it would make sense to me to be able to track it down / get a warning about it

thibautvdu avatar Dec 22 '20 08:12 thibautvdu

That's more clear now, thanks. I will do that :)

dbrizov avatar Dec 22 '20 08:12 dbrizov

@dbrizov awesome, thanks a lot :) I'm available for testing if necessary

thibautvdu avatar Dec 22 '20 13:12 thibautvdu