feat: Installation of Unity Hub

This commit is contained in:
2026-06-28 17:55:09 +07:00
parent 434d77f0b8
commit 07ce777bb9
5 changed files with 13 additions and 2 deletions
+2 -1
View File
@@ -94,7 +94,8 @@ const handlers = {
"unity:status": () => guard(() => unity.unityStatus()), "unity:status": () => guard(() => unity.unityStatus()),
"unity:install": (url) => "unity:install": (url) =>
guard(async () => { guard(async () => {
if (!url.startsWith("unityhub://")) throw new Error("Invalid Unity Hub link"); if (!url.startsWith("unityhub://") && !url.startsWith("https://unity.com/"))
throw new Error("Invalid Unity Hub link");
await shell.openExternal(url); await shell.openExternal(url);
}), }),
@@ -425,7 +425,14 @@ function UnityStatusBody({ status }: { status: UnityStatus }) {
{t(verdict.key)} {t(verdict.key)}
</span> </span>
</div> </div>
{status.match !== "ok" && status.installUrl ? ( {!status.hubInstalled ? (
<div className="mt-1">
<Button onClick={() => void api.unity.install("https://unity.com/download")}>
<Download size={14} />
{t("settings:unity.getHub")}
</Button>
</div>
) : status.match !== "ok" && status.installUrl ? (
<div className="mt-1"> <div className="mt-1">
<Button onClick={() => void api.unity.install(status.installUrl as string)}> <Button onClick={() => void api.unity.install(status.installUrl as string)}>
<Download size={14} /> <Download size={14} />
@@ -68,6 +68,7 @@
"installedVersions": "Installed editors", "installedVersions": "Installed editors",
"status": "Status", "status": "Status",
"install": "Install {{version}} in Unity Hub", "install": "Install {{version}} in Unity Hub",
"getHub": "Get Unity Hub",
"match": { "match": {
"ok": "Match", "ok": "Match",
"missing": "Version not installed", "missing": "Version not installed",
@@ -68,6 +68,7 @@
"installedVersions": "インストール済みエディター", "installedVersions": "インストール済みエディター",
"status": "状態", "status": "状態",
"install": "Unity Hub で {{version}} をインストール", "install": "Unity Hub で {{version}} をインストール",
"getHub": "Unity Hub を入手",
"match": { "match": {
"ok": "一致", "ok": "一致",
"missing": "そのバージョンが未インストール", "missing": "そのバージョンが未インストール",
@@ -68,6 +68,7 @@
"installedVersions": "เอดิเตอร์ที่ติดตั้ง", "installedVersions": "เอดิเตอร์ที่ติดตั้ง",
"status": "สถานะ", "status": "สถานะ",
"install": "ติดตั้ง {{version}} ใน Unity Hub", "install": "ติดตั้ง {{version}} ใน Unity Hub",
"getHub": "ดาวน์โหลด Unity Hub",
"match": { "match": {
"ok": "ตรงกัน", "ok": "ตรงกัน",
"missing": "ยังไม่ได้ติดตั้งเวอร์ชันนี้", "missing": "ยังไม่ได้ติดตั้งเวอร์ชันนี้",