Skip to content
Snippets Groups Projects
Commit 3e3fc74c authored by Victor's avatar Victor
Browse files

Add `DebugLog` utility based on custom scripting symbols

parent 3c1d139d
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ...@@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
## 1.0.7 - 2025-06-30
### Added
- Add `DebugLog` utility based on custom scripting symbols.
## 1.0.6 - 2025-06-24 ## 1.0.6 - 2025-06-24
### Changed ### Changed
......
...@@ -19,7 +19,9 @@ Please follow [this snippet] to add the registry to your project. ...@@ -19,7 +19,9 @@ Please follow [this snippet] to add the registry to your project.
[this snippet]: https://git-st.inf.tu-dresden.de/hyper/core/-/snippets/14 [this snippet]: https://git-st.inf.tu-dresden.de/hyper/core/-/snippets/14
## Quick start guide ## How to use
### Quick start guide
1. Create a new Unity project with **Universal 3D** as the template. 1. Create a new Unity project with **Universal 3D** as the template.
1. Switch the build target platform to **Android**. 1. Switch the build target platform to **Android**.
...@@ -32,9 +34,13 @@ Please follow [this snippet] to add the registry to your project. ...@@ -32,9 +34,13 @@ Please follow [this snippet] to add the registry to your project.
1. Right click on the **Hierarchy** panel, then click **HYPER** > **Core** > **XR**. 1. Right click on the **Hierarchy** panel, then click **HYPER** > **Core** > **XR**.
1. Open **Meta** > **Tools** > **Project Setup Tool**, then click **Fix All** in all tabs. 1. Open **Meta** > **Tools** > **Project Setup Tool**, then click **Fix All** in all tabs.
[Install this package]: https://git-st.inf.tu-dresden.de/hyper/core/-/snippets/14 ### Enable debug messages
Add `HYPER_CORE_DEBUG_LOG` to **Project Settings** > **Player** > **Script Compilation** > **Scripting Define Symbols**.
## Attribution ## Attribution
- Error.wav by Autistic Lucario -- https://freesound.org/s/142608/ -- License: Attribution 4.0 - Error.wav by Autistic Lucario -- https://freesound.org/s/142608/ -- License: Attribution 4.0
- Ping! by unfa -- https://freesound.org/s/215415/ -- License: Creative Commons 0 - Ping! by unfa -- https://freesound.org/s/215415/ -- License: Creative Commons 0
[Install this package]: https://git-st.inf.tu-dresden.de/hyper/core/-/snippets/14
using Debug = UnityEngine.Debug;
using System;
using System.Diagnostics;
using UnityEngine;
namespace Hyper.Core
{
/// <summary>
/// A utility class for logging debug messages.
/// To enable, add "HYPER_CORE_DEBUG_LOG"
/// to Project Settings > Player > Script Compilation > Scripting Define Symbols
/// </summary>
public static class DebugLog
{
[Conditional("HYPER_CORE_DEBUG_LOG")]
public static void Log(LogType mType, string message)
{
switch (mType)
{
case LogType.Error:
Debug.LogError(message);
break;
case LogType.Warning:
Debug.LogWarning(message);
break;
case LogType.Log:
Debug.Log(message);
break;
default:
throw new ArgumentOutOfRangeException(nameof(mType), mType, null);
}
}
}
}
fileFormatVersion: 2
guid: bce965a2554d74bffa9f3a4e4ec9e45d
\ No newline at end of file
...@@ -2,6 +2,8 @@ using System.Linq; ...@@ -2,6 +2,8 @@ using System.Linq;
using Oculus.Interaction.HandGrab; using Oculus.Interaction.HandGrab;
using UnityEngine; using UnityEngine;
namespace Hyper.Core
{
public class TagsUnselect : MonoBehaviour public class TagsUnselect : MonoBehaviour
{ {
[SerializeField] private HandGrabInteractor handGrabInteractorLeft; [SerializeField] private HandGrabInteractor handGrabInteractorLeft;
...@@ -10,6 +12,8 @@ public class TagsUnselect : MonoBehaviour ...@@ -10,6 +12,8 @@ public class TagsUnselect : MonoBehaviour
public void UnselectRightHand() public void UnselectRightHand()
{ {
DebugLog.Log(LogType.Log, "Unselecting right hand interactable");
if (!handGrabInteractorRight.HasSelectedInteractable) return; if (!handGrabInteractorRight.HasSelectedInteractable) return;
if (tags.Contains(handGrabInteractorRight.SelectedInteractable.tag)) if (tags.Contains(handGrabInteractorRight.SelectedInteractable.tag))
...@@ -18,6 +22,8 @@ public class TagsUnselect : MonoBehaviour ...@@ -18,6 +22,8 @@ public class TagsUnselect : MonoBehaviour
public void UnselectLeftHand() public void UnselectLeftHand()
{ {
DebugLog.Log(LogType.Log, "Unselecting left hand interactable");
if (!handGrabInteractorLeft.HasSelectedInteractable) return; if (!handGrabInteractorLeft.HasSelectedInteractable) return;
if (tags.Contains(handGrabInteractorLeft.SelectedInteractable.tag)) if (tags.Contains(handGrabInteractorLeft.SelectedInteractable.tag))
...@@ -30,3 +36,4 @@ public class TagsUnselect : MonoBehaviour ...@@ -30,3 +36,4 @@ public class TagsUnselect : MonoBehaviour
UnselectRightHand(); UnselectRightHand();
} }
} }
}
{ {
"name": "de.tu-dresden.hyper.core", "name": "de.tu-dresden.hyper.core",
"version": "1.0.6", "version": "1.0.7",
"displayName": "HYPER Core", "displayName": "HYPER Core",
"description": "This package helps you to get started quickly with your Unity XR projects.", "description": "This package helps you to get started quickly with your Unity XR projects.",
"unity": "6000.0", "unity": "6000.0",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment