Skip to content

Commit b50eb1f

Browse files
authored
Merge pull request #7 from neocortex-link/feat/component-updates
Feat/component updates
2 parents b7f78e8 + 58b269e commit b50eb1f

18 files changed

+160
-966
lines changed

CHANGELOG.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7-
## [0.0.1] - 21 October 2024
8-
- Initial Release
7+
## [0.3.1] - 3 February 2024
8+
- Microphone dropdown component
9+
- Component and sample updates
10+
11+
## [0.3.0] - 21 January 2024
12+
- WebGL audio support
13+
14+
## [0.2.0] - 6 December 2024
15+
- API updates and request unification
16+
- Audio receiver fixes
17+
- Sample project updates
18+
19+
## [0.1.0] - 21 October 2024
20+
- Initial Release

Editor/EditorUtilities.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class EditorUtilities : MonoBehaviour
1919
/// <param name="callback">Actions to take once component is created in the canvas.</param>
2020
public static void CreateInCanvas<T>(string name, Action<Canvas, T> callback) where T: UIBehaviour
2121
{
22-
var canvas = FindObjectOfType<Canvas>();
22+
var canvas = FindFirstObjectByType<Canvas>();
2323
if (Selection.activeTransform == null)
2424
{
2525
if (canvas == null)
@@ -43,7 +43,7 @@ public static void CreateInCanvas<T>(string name, Action<Canvas, T> callback) wh
4343
}
4444
}
4545

46-
var eventSystem = FindObjectOfType<EventSystem>();
46+
var eventSystem = FindFirstObjectByType<EventSystem>();
4747
if (eventSystem == null)
4848
{
4949
eventSystem = LoadAndInstantiate<EventSystem>(EVENT_SYSTEM_FILE_NAME);

Editor/WebGLTemplateImporter.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,15 @@ private static void OnEditorLoaded()
3939

4040
EditorPrefs.DeleteKey(ImportCompletedKey);
4141

42-
try{
42+
try
43+
{
4344
CopyDirectory(SourceFolder, DestinationFolder);
4445
AssetDatabase.Refresh();
4546
Debug.Log($"WebGL Template copied to {DestinationFolder} successfully.");
4647
}
4748
catch (System.Exception ex)
4849
{
49-
Debug.LogError($"Failed to copy WebGL Template: {ex.Message}");
50+
Debug.LogWarning($"Failed to copy WebGL Template: {ex.Message}");
5051
}
5152
}
5253

Runtime/API/V1/Services/WebRequest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ public class WebRequest
1212

1313
protected async Task<ApiResponse> Send(ApiPayload apiRequest)
1414
{
15+
if (settings == null || string.IsNullOrEmpty(settings.apiKey))
16+
{
17+
Debug.LogError("API Key is required. Please add it in the Tools > Neocortex > API Key Setup.");
18+
return null;
19+
}
20+
1521
UnityWebRequest webRequest = new UnityWebRequest();
1622
webRequest.url = apiRequest.url;
1723
webRequest.method = apiRequest.method;

Runtime/NeocortexMicrophone.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,19 @@ namespace Neocortex
44
{
55
public sealed class NeocortexMicrophone
66
{
7+
public static string[] devices
8+
{
9+
get
10+
{
11+
#if !UNITY_WEBGL || UNITY_EDITOR
12+
return Microphone.devices;
13+
#else
14+
Debug.Log("Use browser settings for microphone access.");
15+
return new string[] { "Use browser settings for microphone access." };
16+
#endif
17+
}
18+
}
19+
720
public static AudioClip Start(string deviceName, bool loop, int lengthSec, int frequency)
821
{
922
#if !UNITY_WEBGL || UNITY_EDITOR
@@ -17,8 +30,6 @@ public static void End(string deviceName)
1730
{
1831
#if !UNITY_WEBGL || UNITY_EDITOR
1932
Microphone.End(deviceName);
20-
#else
21-
return null;
2233
#endif
2334
}
2435

Runtime/UI/NeocortexAudioChatInput.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
namespace Neocortex
66
{
7+
[SelectionBase]
8+
[AddComponentMenu("Neocortex/Audio Chat Input", 0)]
79
public class NeocortexAudioChatInput : UIBehaviour
810
{
911
[SerializeField] private AudioReceiver audioReceiver;

0 commit comments

Comments
 (0)