MyGameApp namespace used like type


#1

Good evening. I’ve been working on the physics tutorials, and there’s a problem. In MyGameApp.cs “Game is a namespace but is used like a type.” What does this mean? I haven’t altered this script at all.


#2

This happens when you have something in scope that has a namespace that contains “Game”. So check your usings namespace definitions.


#3

The default project template has this issue.

You can work around it by changing new Game() to new Xenko.Engine.Game()


#4

That fixes it- thanks!


#5

Is there already an issue to fix this?
When I create a new script the namespace appends .Game and the compiling will fail.


#6

made an issue for this:


#7

@RobertCampbell fix is the way to go in my opinion. @tonfilm you can open a PR to fix the default template :slight_smile:


#8

Added a comment on https://github.com/xenko3d/xenko/issues/163 (we should fix the underlying issue, not prefix wrong namespace)


#9

Some people might still want to have a custom namespace. Maybe the editor prompt (when creating scripts) should check the current value that is set in the .csproj. And append the current folder path (if it’s not already the case).

edit: looking at the commit. That’s exactly what you did.