Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Michel Arendt |
Hello,
I’ve just started on Godot and I’m trying to setup a simple basic project and use the export feature. However, I’m getting an error when running the executable file.
Error:
The way I compiled my Godot Mono was:
GIT BASH
git clone GitHub - godotengine/godot: Godot Engine – Multi-platform 2D and 3D game engine
x64 Native Tools Command Prompt for VS 2017
scons p=windows tools=yes module_mono_enabled=yes mono_glue=no -j4
cd bin
godot.windows.tools.64.mono.exe --generate-mono-glue …/modules/mono/glue
cd …
scons p=windows tools=yes module_mono_enabled=yes mono_glue=yes vsproj=yes -j4
My project:
I’ve created a project, created two scenes. The main scene is the camera one where I’ve attached the following script to a Camera node:
using Godot;
using System;
public class camera_main : Camera
{
// Declare member variables here. Examples:
// private int a = 2;
// private string b = "text";
private Vector3 transform;
private float verticalMovement = 5.0f;
private float horizontalMovement = 5.0f;
private sbyte nbrOfPressedKeys = 0;
// Called when the node enters the scene tree for the first time.
public override void _Ready() {
this.transform = GetCameraTransform().origin;
}
// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(float delta) {
nbrOfPressedKeys = 0;
if (Input.IsKeyPressed((int)KeyList.S)) {
nbrOfPressedKeys++;
}
if (Input.IsKeyPressed((int)KeyList.W)) {
nbrOfPressedKeys++;
}
if (Input.IsKeyPressed((int)KeyList.D)) {
nbrOfPressedKeys++;
}
if (Input.IsKeyPressed((int)KeyList.A)) {
nbrOfPressedKeys++;
}
if (nbrOfPressedKeys > 1) {
if (Input.IsKeyPressed((int)KeyList.S) && Input.IsKeyPressed((int)KeyList.D)) {
transform.z += (verticalMovement / 2) * delta;
transform.x += (horizontalMovement / 2) * delta;
}
if (Input.IsKeyPressed((int)KeyList.S) && Input.IsKeyPressed((int)KeyList.A)) {
transform.z += (verticalMovement / 2) * delta;
transform.x -= (horizontalMovement / 2) * delta;
}
if (Input.IsKeyPressed((int)KeyList.W) && Input.IsKeyPressed((int)KeyList.D)) {
transform.z -= (verticalMovement / 2) * delta;
transform.x += (horizontalMovement / 2) * delta;
}
if (Input.IsKeyPressed((int)KeyList.W) && Input.IsKeyPressed((int)KeyList.A)) {
transform.z -= (verticalMovement / 2) * delta;
transform.x -= (horizontalMovement / 2) * delta;
}
} else {
if (Input.IsKeyPressed((int)KeyList.S)) {
transform.z += verticalMovement * delta;
}
if (Input.IsKeyPressed((int)KeyList.W)) {
transform.z -= verticalMovement * delta;
}
if (Input.IsKeyPressed((int)KeyList.D)) {
transform.x += horizontalMovement * delta;
}
if (Input.IsKeyPressed((int)KeyList.A)) {
transform.x -= horizontalMovement * delta;
}
}
base.Translation = transform;
}
}
Everything works when I test with the editor. However, when I export the project to Windows Desktop and run it, the engine open/closes with the screenshot error (Screenshot by Lightshot) on the command prompt.
My export settings (default):
My export templates:
Can anyone help me with this?
Thanks in advance!