Arch.Extended icon indicating copy to clipboard operation
Arch.Extended copied to clipboard

Getting Started tips?

Open wiredmatt opened this issue 2 years ago • 4 comments

Hey, awesome work! I'm slowly migrating to monogame, I have little experience with modern c#.

I can successfully setup a Monogame project and run it, and also integrate with base Arch. However I'm not being able to get Arch.Extended's EventBus to play well. I just saw #9 but OP didn't mention how exactly did he solve it. Can the EventBus code be generated by running a command, or by specifying it somehow in the csproj? Thank you in advance. I believe this is also a good opportunity to add brief yet effective documentation on how to setup a project with these tools.

wiredmatt avatar Sep 23 '23 15:09 wiredmatt

Thanks for your interest! :)

Well its a source generator. So it should he integrated like any other source-generator. This depends on your environment however, e.g. in pure c# you can just install it as a nuget package and set it up as a source-gen. Thats all :)

What environment are you using? Engine? Just monogame? ^^

genaray avatar Sep 23 '23 16:09 genaray

Hey! thank you for the quick reply, yes I'm using Monogame.

I run what's in the readme after setting up dotnet, and creating a monogame project using dotnet templates.

dotnet add package Arch.System --version 1.0.2
dotnet add package Arch.System.SourceGenerator --version 1.1.1
dotnet add package Arch.EventBus --version 1.0.2
dotnet add package Arch.LowLevel --version 1.0.3
dotnet add package Arch.Relationships --version 1.0.0
dotnet add package Arch.Persistence --version 1.0.2

However, trying to follow your Sample, I get the following:

'EventBus' does not contain a definition for 'Send'

I assume some command should be run, or config added, for example in dart you can do it like this which is super clear to me.

I'm currently reading this but it doesn't look like it's directed at the consumer of a library that uses generators.

$ dotnet build

MSBuild version 17.3.2+561848881 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
/home/mateo/games/flappy-mono/Game1.cs(88,18): error CS0117: 'EventBus' does not contain a definition for 'Send' [/home/mateo/games/flappy-mono/flappy-mono.csproj]

Build FAILED.

/home/mateo/games/flappy-mono/Game1.cs(88,18): error CS0117: 'EventBus' does not contain a definition for 'Send' [/home/mateo/games/flappy-mono/flappy-mono.csproj]
    0 Warning(s)
    1 Error(s)

Every other package picks up well, just this one I don't understand how to configure

wiredmatt avatar Sep 23 '23 16:09 wiredmatt

Have you pulled and tried out the example project from arch.extended? ^^

Does the [Event] annotated method exist? Only if that one exists a .Send will be generated.

genaray avatar Sep 23 '23 16:09 genaray

The above post is the answer - an [Event] method needs to exist or you will see the build error about Send not existing. This should probably be called out in the docs.

metaphist avatar May 07 '24 19:05 metaphist