Fixed bug causing issues with debugging not working

This commit is contained in:
Kah Wei 2022-10-27 17:51:30 +08:00
parent 97432b8666
commit 623e964160
2 changed files with 15 additions and 2 deletions

View File

@ -192,6 +192,12 @@ namespace SHADE
// Copy to built dll to the working directory and replace
std::filesystem::copy_file("./tmp/SHADE_Scripting.dll", "SHADE_Scripting.dll", std::filesystem::copy_options::overwrite_existing);
// If debug, we want to copy the PDB so that we can do script debugging
if (debug)
{
std::filesystem::copy_file("./tmp/SHADE_Scripting.pdb", "SHADE_Scripting.pdb", std::filesystem::copy_options::overwrite_existing);
}
oss << "[ScriptEngine] Successfully built Managed Script Assembly (" << MANAGED_SCRIPT_LIB_NAME << ")!";
SHLOG_INFO(oss.str());
}

View File

@ -1,17 +1,22 @@
using SHADE;
using System;
public class PhysicsTest : Script
{
[SerializeField]
[Tooltip("Force to apply when pressing Space.")]
private Vector3 Force = new Vector3(0.0f, 1.0f, 0.0f);
private Vector3 Force = new Vector3(0.0f, 200.0f, 0.0f);
private Transform Transform;
private RigidBody RigidBody;
private Collider Collider;
public PhysicsTest(GameObject gameObj) : base(gameObj) { }
protected override void awake()
{
Transform = GetComponent<Transform>();
if (Transform == null)
{
Debug.LogError("Transform is NULL!");
}
RigidBody = GetComponent<RigidBody>();
if (RigidBody == null)
{
@ -31,6 +36,8 @@ public class PhysicsTest : Script
if (Input.GetKeyUp(Input.KeyCode.Space))
{
RigidBody.AddForce(Force);
Debug.Log($"Jump!");
}
Debug.Log($"{Transform.LocalPosition.y}");
}
}