#Weird errors after using namespace

1 messages · Page 1 of 1 (latest)

hazy thorn
#

I added a namespace to my CutsceneCollider class and now it's broken. The editor simply stopped working.
It works perfectly without the namespace and yes, I did include the namespace in my editor class. I even tried putting the editor class and my base class inside the same namespace. Does not work either.

lapis shadow
#

Show code

hazy thorn
lapis shadow
#

Interesting

#

Quick sidenote: Why is your behaviour marked Serializable?

#

That's redundant, MonoBehaviour is serializable anyway

hazy thorn
#

Oh well, my bad then

lapis shadow
#

Does the error point to a specific line?

#

the only time I see the type being used is line 296

actionBaseList.Insert(queuePosition, new CutsceneCollider.SFXAction());
#

is there anywhere else it's being referenced?

hazy thorn
#

This one

EditorGUILayout.LabelField("Action: " + queueSpot + " - Type: " + cutsceneAction.actionType.ToString(), EditorStyles.largeLabel);

Line 311

#

That's the Nullreference exception

lapis shadow
#

that's...

#

odd

#

cutsceneAction must be null, but I can't see where, because at no point do you add a null to the list

hazy thorn
#

Yeup, I am pretty confused especially because the namespace is what breaks it

#

It's thoroughly tested and it works perfectly otherwise

lapis shadow
#

Long shot, but what if you rebuilt

hazy thorn
#

blobsweat I haven't tried that yet...

lapis shadow
#

like

#

rebuilt project by deleting csproj and sln I mean

#

so Unity regenerates everything

hazy thorn
#

Okay, will try that!

#

Didn't work BlobSadde

lapis shadow
#

Damn wth

#

Oh wait

#

Do you have all this code in one file?

#

Ahh yes I see, you have the editor stuff nested inside the class

#

That can be an issue

#

Editor stuff should be in an Editor folder

#

and ideally, every class should be in its own file

hazy thorn
#

They are in their own files, I just compiled them together real quick here so I can send them in one .txt :(

#

CutsceneColliderEditor is also in Assets/Editor folder

lapis shadow
#

But you have this

        #region Editor
#if UNITY_EDITOR
        [CustomEditor(typeof(CutsceneCollider))]
        public class CutsceneColliderEditor : Editor
        {
            private int cutsceneEventIndex = 0;
            int queuePosition = 0;

nested inside the class 🤔

hazy thorn
#

Yep, I nested them so I can send them as one .txt to test if that would work. But the same problem persists even if they are separate files

#

Tried both methods

lapis shadow
#

ahh I see

#

hm I am at a loss

hazy thorn
#

Same xD

#

Thankfully, it works without the namespace. I guess I'll just keep it this way until maybe there's a fix someone comes up with

lapis shadow
#

I guess that works, just really inconvenient though because namespaces help with organisation

#

but I truly can't think why this problem is happening

#

I hope you get it resolved soon tho

jovial cedar
#

Do you use *.asmdef file?

hazy thorn
hazy thorn
jovial cedar
#

Similar issue happend to me in two moments:

  1. I changed class name and forgot file name
  2. I do not include in asmdef reference to another definition file
#

Do you have others editor script?

vagrant sluice
hazy thorn
#

And I still don't know what asmdef is kekw

jovial cedar
#

Okay, so your all editor scripts are under Asset/Editor?
Or you have them nested with #if Unity_Editor?

And referenced namespace is inside Asset folder too ?

hazy thorn
#

Yes, I reference the namespace. Yes, They are in Asset/Editor

jovial cedar
#

You wrote this namespace or is it coming from some package?

turbid musk
hazy thorn
jovial cedar
#

Huh.. so its tough

hazy thorn
#

Yeah xD

#

Very confusing