Dialogue: Namespace problem

Failing to reach GameDevTV namespace between scripts in script folder and Assets/Asset Packs/GameDevTV/´Scripts.

Earlier had this problem with Cinemachine and TextMeshPro but I solved them with creating Assembly Definition, but I cannot find GameDevTV namespace.

I’m not sure if I’m understanding the issue…
What do you mean by “failing to reach between scripts”

Are you meaning that a using clause isn’t working?

Is this within Visual Studio Code, but still working in Unity, or is Unity also reporting the namespace missing?

I use Visual Studio 2019. When I try Using GameDevTV for QuestTooltipspawner from Asset/Script folder there is no way to find GameDevTV namespace. Scripts in Assets/Asset Packs/GaveDevTV/Scripts find RPG namespace but Assets/Scripts with RPG namespace cannot find GameDevTV namespace with Using. This is all in Visual Studio and not in Unity. I use Unity 2020.1.8.

I get the following error:
Error CS0246 The type or namespace name ‘GameDevTV’ could not be found (are you missing a using directive or an assembly reference?)

so the line

using GameDevTV.Core.UI.Tooltips;

isn’t working?

All I can think of is that you might need to regenerate the project file…
(Editor/Preferences/External tools/press the Regenerate Project Files button)

Yes the line:
using GameDevTV.Core.UI.Tooltips;
is not working.

I tried Regenerate Project Files button and nothing happened. Sometime I get problem if file path is to long. I have my project in documents/…/… /…/. Is there a problem? Maybe I should just use something like documents/…/project.

Yes, that may be the problem. Unity likes to start projects in a folder under Documents… but there are a number of problems with this, the biggest one being that it’s VERY easy to exceed the 256 character limit in the path of a file.

Even your Documents folder isn’t really Documents… it’s
C:\Users\larsronbeck\Documents, but most of that is hidden from view, to just show “Documents”

All of my projects are in C:\Unity\projectName\ which is about as short a prefix as you can start with.

Thank you Brian! After restarting project it worked with Regenerate Project Files button.

1 Like

Thank you very much!
I have had a lot of problems with this for a long, long time. So this was really a breakthrough.
Maybe my referencing to Cinemachine and ToolTipPro also could work after Regenerate Project Files button. I solved that instead with creating assembly definition and referencing from there.
I tested everything suspecting firewall interference and what not.
So you use very short prefix. I have a lot of projects and I often use copies instead of Git because I think it is hard to get used to Git, and all my projects grows all the time so after a while it is to many folders.

I strongly advise getting used to Git! I think it’s almost as important as what you’re learning in the RPG course when it comes to moving your programming career past making a game. You can’t colloborate with others without at least a basic knowledge.

Right now, the first 1/2 of Ben’s Git course is free to watch, and the course itself is on sale. Scroll down from the course landing page to watch the Free Preview lessons.

Okay I will check into the Git course.

I am sorry Regenerate Project Files button was not working. I answered to fast. It is still not working with my problem above.
I don’t know how to solve this problem. Maybe I should create a new project and import everything. Do you think Visual Studio Code works better with Unity than Visual Studio 2019.

I solved the problem after 1. exporting everything from my project to a new project, 2. and moving assembly definition from assets/scripts/assembly definition to assets/assembly definition. Maybe the the second point was enough.