Stride Forums Archive

MyGameApp namespace used like type

9 posts, 1864 views, 2018-08-17 to 2018-08-28

jgedri (Jorin G ) 2018-08-17 #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.

tonfilm 2018-08-18 #2

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

RobertCampbell (Robert Campbell) 2018-08-19 #3

The default project template has this issue.

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

jgedri (Jorin G ) 2018-08-24 #4 in reply to #3

That fixes it- thanks!

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

tonfilm 2018-08-27 #6

made an issue for this:

Kryptos (Nicolas Musset) 2018-08-27 #7 in reply to #6

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

xen2 (Virgile) 2018-08-28 #8 in reply to #7

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

Kryptos (Nicolas Musset) 2018-08-28 #9 in reply to #8

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.