Skip to content

Commit d647d71

Browse files
com.openai.unity 7.7.9 (#228)
- Fixed Chat sample in 2021.3 LTS
1 parent a8ac177 commit d647d71

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Samples~/Chat/ChatBehaviour.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ public class ChatBehaviour : MonoBehaviour
5959

6060
private readonly List<Tool> assistantTools = new();
6161

62+
#if !UNITY_2022_3_OR_NEWER
63+
private readonly CancellationTokenSource lifetimeCts = new();
64+
private CancellationToken destroyCancellationToken => lifetimeCts.Token;
65+
#endif
66+
6267
private void OnValidate()
6368
{
6469
inputField.Validate();
@@ -82,6 +87,15 @@ private void Awake()
8287
recordButton.onClick.AddListener(ToggleRecording);
8388
}
8489

90+
91+
#if !UNITY_2022_3_OR_NEWER
92+
private void OnDestroy()
93+
{
94+
lifetimeCts.Cancel();
95+
lifetimeCts.Dispose();
96+
}
97+
#endif
98+
8599
private void SubmitChat(string _) => SubmitChat();
86100

87101
private static bool isChatPending;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "OpenAI",
44
"description": "A OpenAI package for the Unity Game Engine to use GPT-4, GPT-3.5, GPT-3 and Dall-E though their RESTful API (currently in beta).\n\nIndependently developed, this is not an official library and I am not affiliated with OpenAI.\n\nAn OpenAI API account is required.",
55
"keywords": [],
6-
"version": "7.7.8",
6+
"version": "7.7.9",
77
"unity": "2021.3",
88
"documentationUrl": "https://github.com/RageAgainstThePixel/com.openai.unity#documentation",
99
"changelogUrl": "https://github.com/RageAgainstThePixel/com.openai.unity/releases",

0 commit comments

Comments
 (0)