Help with Assembly Definition

Hello,

I obviously don’t understand correctly how assembly definitions work, hopefully someone can help me a bit :slight_smile:

Here is my problem:
I have a bunch of scripts under a folder in my Assets. Let’s say under Assets/Scripts/MyProject/. In that folder, I created an assembly definition named “MyProject”.

Now, besides that, I also have another script located elsewhere, i.e. under Assets/Scripts/OtherScript/OtherScript.cs.

I want to be able to use classes/methods from “OtherScript.cs” in one of my scripts located in Assets/Scripts/MyProject/, how can I do that (using assembly definitions)?

What I did is to create an Assembly Definition Reference file in Assets/Scripts/OtherScript/ and this file references the Assembly Definition defined in Assets/Scripts/MyProject/. So, when I look at OtherScript.cs, I see in the inspector that it does indeed belong to “MyProject.dll”.

…but still, I can’t use classes/methods from OtherScript.cs in Assets/Scripts/MyProject/SomeScript.cs, as the compiler says the Type could not be found.

Why isn’t this working?

Thanks a lot!
Arnaud.

Based on what you shared with us, it should work. Are you using namespaces? Did you added the proper using statements if you do?
Otherwise please provide screenshots about the contents of the assembly files in the inspector or the code contents in code tags.

Thank you for your answer!
I don’t use namespaces, no.

Here are some screenshots illustrating this better:

  1. What I called “MyProject”. You can see my “BIMEXPO” Assembly def asset in it.

  2. What I called “other script”. You can see the Asm Def Ref, referencing BIMEXPO.

  3. Inspecting the Outline script, you can see it belongs to “BIMEXPO.dll” (just like the other script in which I want to use Outline.cs classes)

  4. My console… :frowning:

As said, I don’t use namespace in either Outline or my other script, and the class in Outline is public.
I restarted Unity, doesn’t help either.

Any idea?

Thanks again,
Arnaud

It is looking for an OutlineUI not an Outline, you only linked an Outline.cs which contains an Outline MonoBehaviour.
IDK if you renamed this class or you’re looking for another.

2 Likes

Oh my god, you’re right! :sweat_smile::sweat_smile:
Sorry for wasting your time, and thank you! At least I’m sure I understood Asm Def Ref correctly then :smile:

2 Likes