Skip to content

Commit

Permalink
Merge pull request #7 from neocortex-link/feat/component-updates
Browse files Browse the repository at this point in the history
Feat/component updates
  • Loading branch information
srcnalt authored Feb 3, 2025
2 parents b7f78e8 + 58b269e commit b50eb1f
Show file tree
Hide file tree
Showing 18 changed files with 160 additions and 966 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,17 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.0.1] - 21 October 2024
- Initial Release
## [0.3.1] - 3 February 2024
- Microphone dropdown component
- Component and sample updates

## [0.3.0] - 21 January 2024
- WebGL audio support

## [0.2.0] - 6 December 2024
- API updates and request unification
- Audio receiver fixes
- Sample project updates

## [0.1.0] - 21 October 2024
- Initial Release
4 changes: 2 additions & 2 deletions Editor/EditorUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class EditorUtilities : MonoBehaviour
/// <param name="callback">Actions to take once component is created in the canvas.</param>
public static void CreateInCanvas<T>(string name, Action<Canvas, T> callback) where T: UIBehaviour
{
var canvas = FindObjectOfType<Canvas>();
var canvas = FindFirstObjectByType<Canvas>();
if (Selection.activeTransform == null)
{
if (canvas == null)
Expand All @@ -43,7 +43,7 @@ public static void CreateInCanvas<T>(string name, Action<Canvas, T> callback) wh
}
}

var eventSystem = FindObjectOfType<EventSystem>();
var eventSystem = FindFirstObjectByType<EventSystem>();
if (eventSystem == null)
{
eventSystem = LoadAndInstantiate<EventSystem>(EVENT_SYSTEM_FILE_NAME);
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions Editor/WebGLTemplateImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,15 @@ private static void OnEditorLoaded()

EditorPrefs.DeleteKey(ImportCompletedKey);

try{
try
{
CopyDirectory(SourceFolder, DestinationFolder);
AssetDatabase.Refresh();
Debug.Log($"WebGL Template copied to {DestinationFolder} successfully.");
}
catch (System.Exception ex)
{
Debug.LogError($"Failed to copy WebGL Template: {ex.Message}");
Debug.LogWarning($"Failed to copy WebGL Template: {ex.Message}");
}
}

Expand Down
6 changes: 6 additions & 0 deletions Runtime/API/V1/Services/WebRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public class WebRequest

protected async Task<ApiResponse> Send(ApiPayload apiRequest)
{
if (settings == null || string.IsNullOrEmpty(settings.apiKey))
{
Debug.LogError("API Key is required. Please add it in the Tools > Neocortex > API Key Setup.");
return null;
}

UnityWebRequest webRequest = new UnityWebRequest();
webRequest.url = apiRequest.url;
webRequest.method = apiRequest.method;
Expand Down
15 changes: 13 additions & 2 deletions Runtime/NeocortexMicrophone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ namespace Neocortex
{
public sealed class NeocortexMicrophone
{
public static string[] devices
{
get
{
#if !UNITY_WEBGL || UNITY_EDITOR
return Microphone.devices;
#else
Debug.Log("Use browser settings for microphone access.");
return new string[] { "Use browser settings for microphone access." };
#endif
}
}

public static AudioClip Start(string deviceName, bool loop, int lengthSec, int frequency)
{
#if !UNITY_WEBGL || UNITY_EDITOR
Expand All @@ -17,8 +30,6 @@ public static void End(string deviceName)
{
#if !UNITY_WEBGL || UNITY_EDITOR
Microphone.End(deviceName);
#else
return null;
#endif
}

Expand Down
2 changes: 2 additions & 0 deletions Runtime/UI/NeocortexAudioChatInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Neocortex
{
[SelectionBase]
[AddComponentMenu("Neocortex/Audio Chat Input", 0)]
public class NeocortexAudioChatInput : UIBehaviour
{
[SerializeField] private AudioReceiver audioReceiver;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/UI/NeocortexChatPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Neocortex
{
[SelectionBase]
[AddComponentMenu("UI/Neocortex/Chat Panel")]
[AddComponentMenu("Neocortex/Chat Panel", 0)]
public class NeocortexChatPanel : ScrollRect
{
private NeocortexMessage messageItemPrefab;
Expand Down
2 changes: 1 addition & 1 deletion Runtime/UI/NeocortexMicrophoneDropdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ protected override void Awake()

options.Clear();

foreach (string device in Microphone.devices)
foreach (string device in NeocortexMicrophone.devices)
{
options.Add(new OptionData(device));
}
Expand Down
2 changes: 2 additions & 0 deletions Runtime/UI/NeocortexTextChatInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

namespace Neocortex
{
[SelectionBase]
[AddComponentMenu("Neocortex/Text Chat Input", 0)]
public class NeocortexTextChatInput : UIBehaviour
{
[SerializeField] private InputField inputField;
Expand Down
3 changes: 1 addition & 2 deletions Runtime/UI/NeocortexThinkingIndicator.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using UnityEditor;
using UnityEngine;
using UnityEngine.EventSystems;

namespace Neocortex
{
[SelectionBase]
[RequireComponent(typeof(Animator))]
[AddComponentMenu("UI/Neocortex/Thinking Indicator")]
[AddComponentMenu("Neocortex/Thinking Indicator", 0)]
public sealed class NeocortexThinkingIndicator : UIBehaviour
{
private readonly static int IS_VISIBLE = Animator.StringToHash("IsVisible");
Expand Down
60 changes: 25 additions & 35 deletions Samples~/Text and Audio Samples/Audio Sample.unity
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ OcclusionCullingSettings:
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 9
serializedVersion: 10
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
Expand Down Expand Up @@ -42,8 +42,8 @@ RenderSettings:
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 12
m_GIWorkflowMode: 1
serializedVersion: 13
m_BakeOnSceneLoad: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
Expand All @@ -66,9 +66,6 @@ LightmapSettings:
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
Expand Down Expand Up @@ -96,7 +93,7 @@ LightmapSettings:
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 0}
m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
Expand Down Expand Up @@ -388,9 +385,8 @@ Light:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 452547057}
m_Enabled: 1
serializedVersion: 10
serializedVersion: 11
m_Type: 1
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
Expand Down Expand Up @@ -440,8 +436,12 @@ Light:
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ForceVisible: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
m_LightUnit: 1
m_LuxAtDistance: 1
m_EnableSpotReflector: 1
--- !u!4 &452547059
Transform:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -724,6 +724,7 @@ AudioSource:
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 1420307631}
m_Resource: {fileID: 1420307631}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Expand Down Expand Up @@ -1826,7 +1827,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
--- !u!95 &1821888823
Animator:
serializedVersion: 5
serializedVersion: 7
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
Expand All @@ -1840,6 +1841,7 @@ Animator:
m_ApplyRootMotion: 0
m_LinearVelocityBlending: 0
m_StabilizeFeet: 0
m_AnimatePhysics: 0
m_WarningMessage:
m_HasTransformHierarchy: 1
m_AllowConstantClipSamplingOptimization: 1
Expand Down Expand Up @@ -2570,58 +2572,47 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 1850851989}
m_Modifications:
- target: {fileID: 7096255273550292191, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7096255273550292191, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_Name
value: Character Visuals
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
- target: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
Expand All @@ -2632,14 +2623,13 @@ PrefabInstance:
m_SourcePrefab: {fileID: 100100000, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
--- !u!4 &2257841345455660679 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce,
type: 3}
m_CorrespondingSourceObject: {fileID: 7719522783077959134, guid: c1da51de8aa6a934ba81ae966b7046ce, type: 3}
m_PrefabInstance: {fileID: 2257841345455660678}
m_PrefabAsset: {fileID: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1850851989}
- {fileID: 1670874809}
- {fileID: 540140214}
- {fileID: 1850851989}
Loading

0 comments on commit b50eb1f

Please sign in to comment.