Search code examples
c#monogame

Why is there no Activity1 class in MonoGame Shared project for iOS and Android?


I want to create a game for iOS and Android. Therefore, I created a MonoGame Shared project in Visual Studio Community for Mac. But in this project there is just the Game1 class, nothing more.

Normally, there is an Activity1 class in the project when I choose the MonoGame Android template instead of the MonoGame Shared project. I need to edit the Acitivity1.cs for some specific Android code.

Why is there no Acitivity1.cs in the MonoGame Shared project?

Shared project(when I choose the MonoGame Shared project template): enter image description here

Android project(when I choose the MonoGame Android template): enter image description here


Solution

  • Because it is a SHARED project.

    Shared means all platform codes can use this project, but Activity is an Android specfied feature.

    You may need to create 3 projects: Android, iOS and Shared. Wrtite the game logic codes in the shared project, and add this project as a reference of Android and iOS project.