stride3d / stride

Stride Game Engine (formerly Xenko)
https://stride3d.net
MIT License
6.46k stars 932 forks source link

Net5.0 game builds do not use Game.LaunchParameters (Command line arguments) #1019

Open herocrab opened 3 years ago

herocrab commented 3 years ago

Release Type: 4.0 Official Release

Version: 4.0.1.1.1400

Platform(s): Windows

Describe the bug When targetting net5.0-windows, the game no longer produces launch parameters through Game.LaunchParameters. They are available when targetting net framework.

To Reproduce Steps to reproduce the behavior:

  1. Create a new basic project.
  2. Modify the BasicCameraController Start method to access Game.LaunchParameters
  3. You will see the key value pairs when targetting net framework
  4. You will NOT see the key value pairs when targetting net5.0-windows

Expected behavior I would expect command line arguments to be available in any target.

I would upload a repo but this is faster to reproduce through the launcher using the steps above and I verified issue exist with a brand new clean project.

herocrab commented 3 years ago

A workaround for this issue is to manually parse the args[] through main and cache anything you need. LaunchParameters has no setter so unfortunately you can't use it.