jp.keijiro.ai.assistant.extensions 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.attestation.p7m +0 -0
- package/CHANGELOG.md +11 -0
- package/Editor/AIAssistantExtensions.Editor.asmdef +18 -0
- package/Editor/AIAssistantExtensions.Editor.asmdef.meta +7 -0
- package/Editor/PackageSkillRegistrar.cs +147 -0
- package/Editor/PackageSkillRegistrar.cs.meta +11 -0
- package/README.md +18 -6
- package/Skills/GameViewCapture/SKILL.md +118 -0
- package/Skills/GameViewCapture/SKILL.md.meta +7 -0
- package/Skills/GameViewCapture.meta +8 -0
- package/Skills.meta +8 -0
- package/package.json +3 -3
package/.attestation.p7m
CHANGED
|
Binary file
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
6
6
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.1.0] - 2026-04-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Added the `game-view-capture` skill for capturing the Unity Game view through AI Assistant.
|
|
13
|
+
- Added test UI assets for validating Game view and UI capture workflows.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
|
|
17
|
+
- Updated README documentation for the current package features.
|
|
18
|
+
|
|
8
19
|
## [1.0.1] - 2026-04-24
|
|
9
20
|
|
|
10
21
|
### Changed
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "AIAssistantExtensions.Editor",
|
|
3
|
+
"rootNamespace": "",
|
|
4
|
+
"references": [
|
|
5
|
+
"GUID:aa454c0a07d2f4c6d8e03da09405270b"
|
|
6
|
+
],
|
|
7
|
+
"includePlatforms": [
|
|
8
|
+
"Editor"
|
|
9
|
+
],
|
|
10
|
+
"excludePlatforms": [],
|
|
11
|
+
"allowUnsafeCode": false,
|
|
12
|
+
"overrideReferences": false,
|
|
13
|
+
"precompiledReferences": [],
|
|
14
|
+
"autoReferenced": true,
|
|
15
|
+
"defineConstraints": [],
|
|
16
|
+
"versionDefines": [],
|
|
17
|
+
"noEngineReferences": false
|
|
18
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using System.IO;
|
|
5
|
+
using System.Reflection;
|
|
6
|
+
using UnityEditor;
|
|
7
|
+
using UnityEngine;
|
|
8
|
+
|
|
9
|
+
namespace AIAssistantExtensions {
|
|
10
|
+
|
|
11
|
+
static class PackageSkillRegistrar
|
|
12
|
+
{
|
|
13
|
+
static readonly string[] SkillNames = { "game-view-capture", "game-view-ui-capture" };
|
|
14
|
+
|
|
15
|
+
// The settings UI only displays Project/User/Internal source tags.
|
|
16
|
+
const string SkillTag = "Skills.User.Filesystem.Project";
|
|
17
|
+
|
|
18
|
+
const string SkillPath =
|
|
19
|
+
"Packages/jp.keijiro.ai.assistant.extensions/Skills/GameViewCapture/SKILL.md";
|
|
20
|
+
|
|
21
|
+
static Action _rescanHandler;
|
|
22
|
+
static bool _registeredRescanHandler;
|
|
23
|
+
|
|
24
|
+
[InitializeOnLoadMethod]
|
|
25
|
+
static void Initialize()
|
|
26
|
+
{
|
|
27
|
+
RegisterPackageSkills();
|
|
28
|
+
SubscribeToSkillRescan();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
static void RegisterPackageSkills()
|
|
32
|
+
{
|
|
33
|
+
try
|
|
34
|
+
{
|
|
35
|
+
if (!File.Exists(SkillPath))
|
|
36
|
+
return;
|
|
37
|
+
|
|
38
|
+
var skill = CreateSkillFromFile(Path.GetFullPath(SkillPath));
|
|
39
|
+
if (skill == null)
|
|
40
|
+
return;
|
|
41
|
+
|
|
42
|
+
AddTag(skill, SkillTag);
|
|
43
|
+
RemoveExistingSkill();
|
|
44
|
+
AddSkills(skill);
|
|
45
|
+
}
|
|
46
|
+
catch (Exception ex)
|
|
47
|
+
{
|
|
48
|
+
Debug.LogError($"Failed to register AI Assistant extension skills: {ex.Message}");
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
static void SubscribeToSkillRescan()
|
|
53
|
+
{
|
|
54
|
+
if (_registeredRescanHandler)
|
|
55
|
+
return;
|
|
56
|
+
|
|
57
|
+
var scannerType = FindType("Unity.AI.Assistant.Editor.SkillsScanner");
|
|
58
|
+
var eventInfo = scannerType?.GetEvent
|
|
59
|
+
("OnSkillsRescanned", BindingFlags.Static | BindingFlags.NonPublic);
|
|
60
|
+
if (eventInfo == null)
|
|
61
|
+
return;
|
|
62
|
+
|
|
63
|
+
_rescanHandler = () => EditorApplication.delayCall += RegisterPackageSkills;
|
|
64
|
+
var addMethod = eventInfo.GetAddMethod(true);
|
|
65
|
+
if (addMethod == null)
|
|
66
|
+
return;
|
|
67
|
+
|
|
68
|
+
addMethod.Invoke(null, new object[] { _rescanHandler });
|
|
69
|
+
_registeredRescanHandler = true;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
static object CreateSkillFromFile(string fullPath)
|
|
73
|
+
{
|
|
74
|
+
var skillUtilsType = FindType("Unity.AI.Assistant.Skills.SkillUtils");
|
|
75
|
+
if (skillUtilsType == null)
|
|
76
|
+
throw new InvalidOperationException("AI Assistant SkillUtils type was not found.");
|
|
77
|
+
|
|
78
|
+
var method = skillUtilsType?.GetMethod
|
|
79
|
+
("CreateSkillFromFile", BindingFlags.Static | BindingFlags.NonPublic);
|
|
80
|
+
if (method == null)
|
|
81
|
+
throw new InvalidOperationException("AI Assistant SkillUtils.CreateSkillFromFile method was not found.");
|
|
82
|
+
|
|
83
|
+
return method.Invoke(null, new object[] { fullPath });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static void AddTag(object skill, string tag)
|
|
87
|
+
{
|
|
88
|
+
var method = skill.GetType().GetMethod
|
|
89
|
+
("WithTag", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
90
|
+
if (method == null)
|
|
91
|
+
throw new InvalidOperationException("AI Assistant SkillDefinition.WithTag method was not found.");
|
|
92
|
+
|
|
93
|
+
method.Invoke(skill, new object[] { tag });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
static void AddSkills(object skill)
|
|
97
|
+
{
|
|
98
|
+
var registryType = FindType("Unity.AI.Assistant.Skills.SkillsRegistry");
|
|
99
|
+
if (registryType == null)
|
|
100
|
+
throw new InvalidOperationException("AI Assistant SkillsRegistry type was not found.");
|
|
101
|
+
|
|
102
|
+
var method = registryType?.GetMethod
|
|
103
|
+
("AddSkills", BindingFlags.Static | BindingFlags.Public);
|
|
104
|
+
if (method == null)
|
|
105
|
+
throw new InvalidOperationException("AI Assistant SkillsRegistry.AddSkills method was not found.");
|
|
106
|
+
|
|
107
|
+
var listType = typeof(List<>).MakeGenericType(skill.GetType());
|
|
108
|
+
var list = (IList)Activator.CreateInstance(listType);
|
|
109
|
+
if (list == null)
|
|
110
|
+
throw new InvalidOperationException("Failed to create a SkillDefinition list.");
|
|
111
|
+
|
|
112
|
+
list.Add(skill);
|
|
113
|
+
|
|
114
|
+
method.Invoke(null, new object[] { list, null });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
static void RemoveExistingSkill()
|
|
118
|
+
{
|
|
119
|
+
var registryType = FindType("Unity.AI.Assistant.Skills.SkillsRegistry");
|
|
120
|
+
if (registryType == null)
|
|
121
|
+
return;
|
|
122
|
+
|
|
123
|
+
var method = registryType.GetMethod
|
|
124
|
+
("GetSkills", BindingFlags.Static | BindingFlags.Public);
|
|
125
|
+
var skills = method?.Invoke(null, null) as IDictionary;
|
|
126
|
+
if (skills == null)
|
|
127
|
+
return;
|
|
128
|
+
|
|
129
|
+
foreach (var skillName in SkillNames)
|
|
130
|
+
if (skills.Contains(skillName))
|
|
131
|
+
skills.Remove(skillName);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
static Type FindType(string fullName)
|
|
135
|
+
{
|
|
136
|
+
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
|
|
137
|
+
{
|
|
138
|
+
var type = assembly.GetType(fullName, false);
|
|
139
|
+
if (type != null)
|
|
140
|
+
return type;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
} // namespace AIAssistantExtensions
|
package/README.md
CHANGED
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
# AIA Extensions
|
|
2
2
|
|
|
3
|
-
**AIA Extensions** is a custom Unity package that
|
|
4
|
-
AI Assistant.
|
|
3
|
+
**AIA Extensions** is a custom Unity package that extends Unity AI Assistant.
|
|
5
4
|
|
|
6
5
|
## IME Proxy
|
|
7
6
|
|
|
8
7
|
<img width="400" height="284" alt="IME Proxy" src="https://github.com/user-attachments/assets/a6b5146d-1b63-47dd-ab4d-633357996974" />
|
|
9
8
|
|
|
10
9
|
**IME Proxy** is a custom window that works around several IME-related issues,
|
|
11
|
-
especially when entering Japanese text.
|
|
10
|
+
especially when entering Japanese text. Open it from
|
|
12
11
|
`Window > AI > IME Proxy`. It automatically copies the contents of its text
|
|
13
12
|
field to the AI Assistant chat field and sends the message when you press
|
|
14
13
|
`⌘ + Enter`.
|
|
15
14
|
|
|
15
|
+
## Conversation Extractor
|
|
16
|
+
|
|
17
|
+
<img width="400" height="312" alt="Conversation Extractor" src="https://github.com/user-attachments/assets/aba49e99-3751-47de-a7fd-7b9a4667866f" />
|
|
18
|
+
|
|
19
|
+
**Conversation Extractor** is a utility that extracts the conversation log
|
|
20
|
+
between the user and Unity AI Assistant from `Logs/relay.txt`.
|
|
21
|
+
|
|
22
|
+
## Game View Capture Skill
|
|
23
|
+
|
|
24
|
+
**Game View Capture Skill** lets Unity AI Assistant capture the Game view and
|
|
25
|
+
inspect the rendered image. It is useful for checking camera composition,
|
|
26
|
+
visual effects, and screen-space UI without entering Play Mode.
|
|
27
|
+
|
|
16
28
|
## Font Modifier
|
|
17
29
|
|
|
18
|
-
This package includes `AssistantFontModifier
|
|
19
|
-
AI Assistant chat window with
|
|
20
|
-
overflow issue that occurs in the Unity Editor on macOS.
|
|
30
|
+
This package includes `AssistantFontModifier`, which replaces the fonts used in
|
|
31
|
+
the AI Assistant chat window with Noto Sans JP. This helps prevent the font
|
|
32
|
+
atlas overflow issue that occurs in the Unity Editor on macOS.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: game-view-capture
|
|
3
|
+
description: Capture the Unity Game view in Edit Mode so Assistant can visually inspect the rendered game output without entering Play Mode.
|
|
4
|
+
required_packages:
|
|
5
|
+
com.unity.ai.assistant: 2.6.0-pre.1
|
|
6
|
+
tools:
|
|
7
|
+
- Unity.RunCommand
|
|
8
|
+
- Unity.FindProjectAssets
|
|
9
|
+
- Unity.GetImageAssetContent
|
|
10
|
+
- Unity.GetConsoleLogs
|
|
11
|
+
enabled: true
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Game View Capture
|
|
15
|
+
|
|
16
|
+
Use this skill when the user wants Assistant to visually inspect what the Unity Game view renders. This includes camera output, composition, lighting, materials, sprites, post-processing, and screen-space overlays.
|
|
17
|
+
|
|
18
|
+
This workflow is intended for Edit Mode. Do not enter Play Mode unless the user explicitly asks for runtime-only behavior.
|
|
19
|
+
|
|
20
|
+
## When To Use
|
|
21
|
+
|
|
22
|
+
- Use this skill when Scene View screenshots are insufficient because they do not show the same camera composition, post-processing, or screen-space overlays as the Game view.
|
|
23
|
+
- Use this skill to verify visual output from a camera, including framing, object visibility, lighting, material appearance, sprite layout, and render pipeline effects.
|
|
24
|
+
- Use this skill for quick visual feedback loops while editing scenes, prefabs, visual effects, UI, or camera settings.
|
|
25
|
+
- Use this skill for UI checks when the user asks to inspect uGUI canvases, UI Toolkit `UIDocument` output, HUDs, menus, panels, text rendering, clipping, or overlay placement.
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
1. Use `Unity.RunCommand` to focus and repaint the Game view, then call `ScreenCapture.CaptureScreenshot(path)`.
|
|
30
|
+
2. Save the capture at `Assets/GameViewCapture.png`, overwriting the previous capture unless the user asks to preserve multiple captures.
|
|
31
|
+
3. Because `ScreenCapture.CaptureScreenshot` writes asynchronously, do not assume the texture is immediately importable in the same command.
|
|
32
|
+
4. After the capture command finishes, use a second step to import or locate the generated PNG.
|
|
33
|
+
5. During import, set texture import options so the screenshot keeps its original dimensions. In particular, disable NPOT scaling.
|
|
34
|
+
6. Use `Unity.FindProjectAssets` to find the screenshot asset if you need its instance ID.
|
|
35
|
+
7. Use `Unity.GetImageAssetContent` on the screenshot asset so Assistant can inspect the image visually.
|
|
36
|
+
8. Report the visible Game view state and any concrete issues found. Mention if the image is blank, stale, or appears to show the wrong view.
|
|
37
|
+
|
|
38
|
+
## Recommended Capture Command
|
|
39
|
+
|
|
40
|
+
Use this as the default `Unity.RunCommand` script:
|
|
41
|
+
|
|
42
|
+
```csharp
|
|
43
|
+
using System;
|
|
44
|
+
using System.IO;
|
|
45
|
+
using UnityEditor;
|
|
46
|
+
using UnityEngine;
|
|
47
|
+
|
|
48
|
+
internal class CommandScript : IRunCommand
|
|
49
|
+
{
|
|
50
|
+
public void Execute(ExecutionResult result)
|
|
51
|
+
{
|
|
52
|
+
const string path = "Assets/GameViewCapture.png";
|
|
53
|
+
|
|
54
|
+
var gameViewType = Type.GetType("UnityEditor.GameView,UnityEditor");
|
|
55
|
+
var gameView = gameViewType != null ? EditorWindow.GetWindow(gameViewType) : null;
|
|
56
|
+
if (gameView != null)
|
|
57
|
+
{
|
|
58
|
+
gameView.Focus();
|
|
59
|
+
gameView.Repaint();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
ScreenCapture.CaptureScreenshot(path);
|
|
63
|
+
result.Log("ScreenshotPath: {0}", path);
|
|
64
|
+
result.Log("Wait briefly, then import or locate this asset before reading image content.");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Follow-Up Import Command
|
|
70
|
+
|
|
71
|
+
If the screenshot is not visible as an asset yet, use this command after the capture step:
|
|
72
|
+
|
|
73
|
+
```csharp
|
|
74
|
+
using System.IO;
|
|
75
|
+
using UnityEditor;
|
|
76
|
+
|
|
77
|
+
internal class CommandScript : IRunCommand
|
|
78
|
+
{
|
|
79
|
+
public void Execute(ExecutionResult result)
|
|
80
|
+
{
|
|
81
|
+
const string path = "Assets/GameViewCapture.png";
|
|
82
|
+
|
|
83
|
+
if (!File.Exists(path))
|
|
84
|
+
throw new FileNotFoundException("The Game view screenshot has not been written yet.", path);
|
|
85
|
+
|
|
86
|
+
AssetDatabase.ImportAsset(path, ImportAssetOptions.ForceUpdate);
|
|
87
|
+
var importer = AssetImporter.GetAtPath(path) as TextureImporter;
|
|
88
|
+
if (importer != null)
|
|
89
|
+
{
|
|
90
|
+
importer.textureType = TextureImporterType.Default;
|
|
91
|
+
importer.npotScale = TextureImporterNPOTScale.None;
|
|
92
|
+
importer.maxTextureSize = 16384;
|
|
93
|
+
importer.textureCompression = TextureImporterCompression.Uncompressed;
|
|
94
|
+
importer.SaveAndReimport();
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var asset = AssetDatabase.LoadAssetAtPath<UnityEngine.Texture2D>(path);
|
|
98
|
+
if (asset == null)
|
|
99
|
+
throw new FileLoadException("The screenshot exists but could not be loaded as a Texture2D.", path);
|
|
100
|
+
|
|
101
|
+
result.Log("ScreenshotAssetPath: {0}", path);
|
|
102
|
+
result.Log("ScreenshotSize: {0}x{1}", asset.width, asset.height);
|
|
103
|
+
result.Log("ScreenshotInstanceID: {0}", asset.GetInstanceID());
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Constraints
|
|
109
|
+
|
|
110
|
+
- This skill captures the Game view, not the whole desktop and not the Scene view.
|
|
111
|
+
- Captures are written to `Assets/GameViewCapture.png` so they can be imported and inspected with `Unity.GetImageAssetContent`.
|
|
112
|
+
- Reuse `Assets/GameViewCapture.png` for repeated captures unless the user asks to preserve separate capture files.
|
|
113
|
+
- It does not use `superSize` or `stereoCaptureMode`.
|
|
114
|
+
- Keep the imported texture at its original pixel dimensions. Always set `TextureImporter.npotScale = TextureImporterNPOTScale.None` before reading the image content.
|
|
115
|
+
- The screenshot can be stale if the Game view has not repainted. Always focus and repaint the Game view before capture.
|
|
116
|
+
- The result depends on the Game view resolution, selected aspect ratio, active camera setup, and currently rendered scene state.
|
|
117
|
+
- Screen-space UI may depend on the Game view resolution and selected aspect ratio. Edit Mode UI Toolkit output requires an active `UIDocument` and a valid `PanelSettings` asset.
|
|
118
|
+
- If capture or import fails, inspect `Unity.GetConsoleLogs` before retrying.
|
package/Skills.meta
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jp.keijiro.ai.assistant.extensions",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"displayName": "AI Assistant Extensions",
|
|
5
5
|
"description": "Custom Unity package that provides extensions for Unity AI Assistant.",
|
|
6
6
|
"unity": "6000.0",
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"licensesUrl": "https://github.com/keijiro/AIA-Extensions/blob/master/LICENSE",
|
|
14
14
|
"license": "Unlicense",
|
|
15
15
|
"_upm": {
|
|
16
|
-
"changelog": "-
|
|
16
|
+
"changelog": "<b>Added</b><br>- Added the `game-view-capture` skill for capturing the Unity Game view through AI Assistant.<br>- Added test UI assets for validating Game view and UI capture workflows.<br><br><b>Changed</b><br>- Updated README documentation for the current package features."
|
|
17
17
|
},
|
|
18
18
|
"repository": {
|
|
19
19
|
"url": "git@github.com:keijiro/AIA-Extensions.git",
|
|
20
20
|
"type": "git",
|
|
21
|
-
"revision": "
|
|
21
|
+
"revision": "2ef3199be43d000696a167e3b8db61bf12b479a2"
|
|
22
22
|
}
|
|
23
23
|
}
|