Think I found a mistake in C# Rolling Ball

#1
I guess I found a mistake in the C# sample Project "Rolling Ball".
When I want to compile Player.cs 6 Errors come up.
It says it doesnt expect "=" where a value is defined after the {get; set;}


I changed them to this to work:

Code: Select all

/// <summary> /// Strength of the per-frame impulse when holding inputs /// </summary> /// <value>The move impulse strength.</value> [EntityProperty(0, "Strength of the per-frame impulse when holding inputs")] public float MoveImpulseStrength{ get; set; } /// <summary> /// Speed at which the player rotates entity yaw /// </summary> /// <value>The rotation speed yaw.</value> [EntityProperty(0, "Speed at which the player rotates entity yaw")] public float RotationSpeedYaw{ get; set; } /// <summary> /// Speed at which the player rotates entity pitch /// </summary> /// <value>The rotation speed pitch.</value> [EntityProperty(0, "Speed at which the player rotates entity pitch")] public float RotationSpeedPitch{ get; set; } /// <summary> /// Minimum entity pitch limit /// </summary> /// <value>The rotation limits minimum pitch.</value> [EntityProperty(0, "Minimum entity pitch limit")] public float RotationLimitsMinPitch{ get; set; } /// <summary> /// Maximum entity pitch limit /// </summary> /// <value>The rotation limits max pitch.</value> [EntityProperty(0, "Maximum entity pitch limit")] public float RotationLimitsMaxPitch{ get; set; }
And added this to the constructor:

Code: Select all

public Player() { Initialize(); this.MoveImpulseStrength = 800.0f; this.RotationSpeedYaw = 0.05f; this.RotationSpeedPitch = 0.05f; this.RotationLimitsMinPitch = -0.84f; this.RotationLimitsMaxPitch = 1.5f; this.ViewDistance = 10.0f; }
Then I removed nameof(player) in PlayerView.cs:

Code: Select all

public PlayerView(Player player) { if(player == null) { throw new ArgumentNullException(); } _player = player; }

Then everything works as expected. Did anyone experience the same?

Re: Think I found a mistake in C# Rolling Ball

#2
Hi omginput, I just had a look at the template and I think that I know what's going wrong. The Rolling Ball template uses auto-property initializers from C# 6.0 which is supported. But it looks that by default MonoDevelop uses its own Mono instead of the one that is supplied with the rest of the engine.
To fix this follow the following steps in MonoDevelop:
  1. Open the project in MonoDevelop as usual.
  2. Go to Tools, and select Options.
  3. In the left-side menu select .NET Runtimes (it's grouped in Projects).
  4. In the menu on the right press the Add button.
  5. Browse to your CRYENGINE Launcher folder (default is "C:\Program Files (x86)\Crytek\CRYENGINE Launcher").
  6. From there continue to the Mono folder located in "Crytek\CRYENGINE_5.3\bin\common\Mono" and press Select Folder.
  7. There should now be a new entry in you .NET Runtimes called Mono 4.4.1 (Visual), select this and press Set as Default.
This should make the template build again, and enables you to use all the nice features from C# 6.0. If it's still not working make sure that under the Project menu the Active Runtime is set to Mono 4.4.1 and restart MonoDevelop once.

Thank you for letting us know about this, I will work on a fix so MonoDevelop has the right runtime by default in the future.

By the way, you can also use Visual Studio or Xamarin Studio to work on the solution if you prefer that. They're a bit more C# 6.0 friendly, you just have to make sure that their runtimes are also set to Mono 4.4.1.

Who is online

Users browsing this forum: No registered users and 1 guest