Skip to content

chore: consolidate and migrate native-apps/unity_ii to icp-cli#1440

Merged
raymondk merged 15 commits into
masterfrom
chore/migrate-unity-ii-to-icp-cli
Jul 13, 2026
Merged

chore: consolidate and migrate native-apps/unity_ii to icp-cli#1440
raymondk merged 15 commits into
masterfrom
chore/migrate-unity-ii-to-icp-cli

Conversation

@marc0olo

@marc0olo marc0olo commented Jul 10, 2026

Copy link
Copy Markdown
Member

Closes #1347.

Summary

Consolidates unity_ii_applink, unity_ii_deeplink, and unity_ii_universallink into a single canonical unity_ii_deeplink example and migrates it from dfx to icp-cli.

Migration (dfx → icp-cli)

  • Removes ii_integration_dapp/ (webpack + @dfinity/* packages); replaces with ii-bridge/ (Vite + @icp-sdk/auth v7 + @icp-sdk/core v5.3 — no @dfinity/* packages remain)
  • dfx.jsonicp.yaml + mops.toml
  • Backend: mo:base/Principalmo:core/Principal
  • Adds test.sh and .github/workflows/unity_ii_deeplink.yml

ICP.NET upgrade (BoomDAO fork v4 → edjCase upstream v7.0.2)

  • DLLs moved to the standard Unity location: Assets/ICP.NET/Assets/Plugins/ICP.NET/
  • SubjectPublicKeyInfo namespace: EdjCase.ICP.Candid.ModelsEdjCase.ICP.Agent
  • Test and Windows-only DLLs removed from committed assets (Moq, Castle.Core, System.Diagnostics.EventLog, System.Security.Principal.Windows)
  • Adds UnityHttp.cs (Unity-specific HTTP adapter shipped with v7) and link.xml (prevents IL2CPP stripping of ICP.NET assemblies)
  • Hex helpers added (ToHex/FromHex) to replace ByteUtil (now internal in v7) and Convert.From/ToHexString (not available in Unity's .NET Standard 2.1 runtime)

Security improvements

  • Session key validation before constructing DelegationIdentity: checks that delegations[last].delegation.pubkey matches SessionIdentity.PublicKey.ToDerEncoding() — guards against a mismatched or replayed delegation chain
  • Delegation passed as URI fragment (#delegation=) instead of query string (?delegation=) so the credential is not included in any HTTP request if the app is not installed and the OS falls back to opening the URL in a browser

Code cleanup

  • TestICPAgentICPAgent, TestIdentitySessionIdentity, mTestICPAgentmIcpAgent
  • Hardcoded test canister ID cleared from SampleScene.unity

Documentation

  • TESTING.md: 4-level testing guide (backend-only → browser delegation flow → Android emulator → mainnet)
  • README: replaces vague "Platform variants" section with a concrete "Upgrading to HTTPS deep links for production" guide — includes full PBXProject-based iOSPostBuildProcessor.cs replacement, AASA file format, assetlinks.json format, and .ic-assets.json5 to expose .well-known/ from the asset canister
  • unity_project/README.md updated for new class names and ICP.NET location

Key decisions

Double-delegation bridge — preserved intact; educational value depends on it.

No local II deploymenticp.yaml has no ii: true. The ii-bridge hardcodes https://id.ai/authorize (the default in @icp-sdk/auth v7). icp-cli ≥ 0.2.4 trusts mainnet BLS signatures on the local replica, so delegations from mainnet II work locally.

Custom URL scheme for local dev, HTTPS for production — the example ships with org.dfinity.unity-ii:// (works without HTTPS), with a documented upgrade path to Android App Links and iOS Universal Links in the README.

Single example — App Links, Universal Links, and custom scheme share identical core logic (double-delegation, ICP.NET, ii-bridge). Separate projects would triple the maintenance burden for a handful of constant changes; the README's upgrade section provides concrete code instead.

What can be tested locally

Step Testable locally? Notes
II login in mobile browser ✅ Yes Uses mainnet II (https://id.ai)
Deep link callback (org.dfinity.unity-ii://) ✅ Yes Custom URL scheme, no HTTPS needed
Backend canister call with delegation ✅ Yes Local replica accepts mainnet-signed chain
Android App Links (HTTPS) ❌ No Requires deployed assetlinks.json over HTTPS
iOS Universal Links ❌ No Requires Apple developer account + HTTPS AASA

Test plan

  • icp network start -d && icp deploy && bash test.sh passes in native-apps/unity_ii_deeplink
  • II bridge builds without errors: npm run build --prefix ii-bridge
  • CI workflow passes
  • Full end-to-end flow on Android emulator (see TESTING.md Level 3)
  • Mainnet smoke test: icp deploy -e ic, update Unity Inspector with output of icp canister status ii-bridge -i -e ic and icp canister status backend -i -e ic

🤖 Generated with Claude Code

Consolidates unity_ii_applink and unity_ii_universallink into
unity_ii_deeplink and migrates the entire example to icp-cli.

- Replace dfx.json + webpack with icp.yaml, mops.toml, and Vite
- Port frontend to @icp-sdk/auth v7 + @icp-sdk/core v5.3 (no @dfinity/* deps)
  - AuthClient.signIn() replaces the old login({onSuccess}) callback pattern
  - ECDSAKeyIdentity, DelegationChain, Ed25519PublicKey from @icp-sdk/core/identity
  - identityProvider defaults to https://id.ai/authorize (works locally since
    icp-cli >= 0.2.4 trusts mainnet II signatures on the local replica)
- Update app.mo to use mo:core/Principal (replaces mo:base/Principal)
- Add duplicate-check to AndroidPostBuildProcessor.cs (from applink variant)
- Make greetFrontend, greetBackendCanister, icGateway configurable fields
  in TestICPAgent.cs (removes hardcoded mainnet canister IDs)
- Add test.sh, CI workflow, and consolidated README documenting local vs
  mainnet testability for all three URL-scheme variants

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo marc0olo requested review from a team as code owners July 10, 2026 13:33
marc0olo and others added 6 commits July 10, 2026 15:57
- After II login, show "Logged in as: <principal>" in the page instead of
  no visible feedback
- Replace silent console.error on Launch button with an inline message when
  the page was opened without a sessionkey (direct browser, not from Unity app)
- Add TESTING.md with the full test sequence for Levels 1–4

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace `icp canister id` with `icp canister status -i` throughout
  TESTING.md and README.md
- Note AgentAndPlugin as the GameObject that holds TestICPAgent

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Rename `frontend/` canister and directory to `ii-bridge/` throughout
  (icp.yaml, package.json, .gitignore, Unity inspector field, scene YAML)
- Rewrite README with double-delegation explanation and non-extractable
  key reasoning; add physical device testing section and security notes
- Rewrite unity_project/README with current architecture and key files
- Overhaul TESTING.md: drop status lines, fix stale button/GameObject
  names, add emulator settings table and passkey setup instructions
- Improve II bridge UX: hide sign-in button after delegation received,
  re-show on greet failure, add SESSION_DURATION_MS constant,
  add no-session-key message and structured HTML sections
- Rename OpenBrowser() → SignIn() in DeepLinkPlugin.cs; keep scene
  YAML m_MethodName in sync
- Add [Serializable] to DelegationUtils model classes for JsonUtility
- Rename URL scheme internetidentity → org.dfinity.unity-ii
- Gitignore UserSettings/ in unity_project; update root .gitignore
  for renamed ii-bridge paths

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…egation

- Replace BoomDAO/ICP.NET v4 DLLs (Assets/ICP.NET/) with upstream
  edjCase/ICP.NET v7.0.2 (Assets/Plugins/ICP.NET/) via agent.unitypackage
- Adapt DeepLinkPlugin.cs for v7 API: SubjectPublicKeyInfo moved to
  EdjCase.ICP.Agent namespace; ByteUtil is internal — replace with
  private ToHex/FromHex helpers (BitConverter + Convert.ToByte)
- Add delegation chain validation: verify last delegation's pubkey
  matches the session key before constructing DelegationIdentity
- Change deep link callback to URI fragment (#delegation=) so the
  delegation is not sent to any server if the app is not installed
- Rename TestICPAgent → ICPAgent, TestIdentity → SessionIdentity,
  mTestICPAgent → mIcpAgent throughout; GUID preserved so scene
  bindings are unaffected
- Clear greetBackendCanister default — was a stale placeholder; empty
  field makes it obvious the value must be set after icp deploy
- Fix icp canister id → icp canister status -i throughout all docs
- Update all BoomDAO links to edjCase/ICP.NET

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Moq and Castle.Core are test-only dependencies; System.Diagnostics.EventLog
and System.Security.Principal.Windows are Windows-only and break Android/iOS
IL2CPP builds. EdjCase.ICP.WebSockets.deps.json is a .NET CLI manifest not
needed by Unity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…docs

Clear the local canister ID from SampleScene.unity (left over from
testing) so new developers start with a blank field. Expand the
"Upgrading to HTTPS deep links" section with concrete PBXProject code
for iOS Universal Links and step-by-step Android App Links instructions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR consolidates the Unity + Internet Identity native-app examples by removing the unity_ii_applink and unity_ii_universallink variants and migrating the remaining canonical native-apps/unity_ii_deeplink example from dfx to icp-cli, including updating the Unity project and introducing a new Vite-based “ii-bridge” asset canister.

Changes:

  • Consolidate examples: delete legacy unity_ii_applink and unity_ii_universallink trees and remove the old ii_integration_dapp (webpack/@dfinity/*) approach.
  • Add icp-cli project structure for native-apps/unity_ii_deeplink (icp.yaml, mops.toml, test.sh, CI workflow) and a Vite-based ii-bridge asset canister.
  • Update the Unity project to new scripts/config (scene wiring, plugin assets, link.xml, updated post-build processors, and updated ICP.NET plugin placement).

Reviewed changes

Copilot reviewed 201 out of 253 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.github/workflows/unity_ii_deeplink.yml Adds CI job to icp deploy and run test.sh for the migrated example
native-apps/unity_ii_deeplink/.gitignore Ignores Node/Vite build outputs and generated bindings for the new bridge
native-apps/unity_ii_deeplink/backend/app.mo New Motoko backend canister entry point using mo:core/Principal
native-apps/unity_ii_deeplink/backend/backend.did New Candid interface for the backend canister
native-apps/unity_ii_deeplink/icp.yaml New icp-cli canister definitions for backend + bridge asset canister
native-apps/unity_ii_deeplink/mops.toml Pins Motoko toolchain/deps and wires candid/main paths
native-apps/unity_ii_deeplink/package.json Adds npm workspace root for the ii-bridge frontend build
native-apps/unity_ii_deeplink/test.sh Adds an icp-cli test script validating backend.greet output
native-apps/unity_ii_deeplink/ii-bridge/index.html New Vite frontend entry for the II bridge flow
native-apps/unity_ii_deeplink/ii-bridge/package.json New Vite + @icp-sdk/* dependencies for the bridge
native-apps/unity_ii_deeplink/ii-bridge/public/main.css Styling for the bridge UI
native-apps/unity_ii_deeplink/ii-bridge/vite.config.js Dev-server cookie + proxy configuration + bindgen generation
native-apps/unity_ii_deeplink/ii_integration_dapp/.gitignore Deleted legacy dfx-generated / webpack ignore rules
native-apps/unity_ii_deeplink/ii_integration_dapp/Makefile Deleted legacy dfx-based build/install/test targets
native-apps/unity_ii_deeplink/ii_integration_dapp/README.md Deleted legacy dfx deployment instructions
native-apps/unity_ii_deeplink/ii_integration_dapp/canister_ids.json Deleted legacy mainnet canister-id mapping for dfx
native-apps/unity_ii_deeplink/ii_integration_dapp/dfx.json Deleted legacy dfx project configuration
native-apps/unity_ii_deeplink/ii_integration_dapp/package.json Deleted legacy webpack/@dfinity/* frontend deps
native-apps/unity_ii_deeplink/ii_integration_dapp/src/greet_backend/main.mo Deleted legacy backend (replaced by backend/app.mo)
native-apps/unity_ii_deeplink/ii_integration_dapp/src/greet_frontend/assets/main.css Deleted legacy frontend styling
native-apps/unity_ii_deeplink/ii_integration_dapp/src/greet_frontend/assets/sample-asset.txt Deleted sample asset
native-apps/unity_ii_deeplink/ii_integration_dapp/src/greet_frontend/src/index.html Deleted legacy frontend HTML
native-apps/unity_ii_deeplink/ii_integration_dapp/src/greet_frontend/src/index.js Deleted legacy frontend JS
native-apps/unity_ii_deeplink/ii_integration_dapp/webpack.config.js Deleted legacy webpack config
native-apps/unity_ii_deeplink/unity_project/.gitignore Updates Unity gitignore to ignore per-developer UserSettings/
native-apps/unity_ii_deeplink/unity_project/Assets/Editor/AndroidPostBuildProcessor.cs Updates Android deep link scheme and avoids reinjecting on incremental builds
native-apps/unity_ii_deeplink/unity_project/Assets/Editor/iOSPostBuildProcessor.cs Updates iOS URL scheme to org.dfinity.unity-ii
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/BouncyCastle.Cryptography.dll.meta Deleted old ICP.NET asset meta (moved to Plugins location)
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/LICENSE Deleted old ICP.NET embedded license file
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/LICENSE.meta Deleted old ICP.NET license meta
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/Microsoft.Bcl.HashCode.dll.meta Deleted old ICP.NET plugin meta
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/README.md Deleted old ICP.NET README
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/System.Formats.Asn1.dll.meta Deleted old ICP.NET plugin meta
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/System.Formats.Cbor.dll.meta Deleted old ICP.NET plugin meta
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/System.Runtime.CompilerServices.Unsafe.dll.meta Deleted old ICP.NET plugin meta
native-apps/unity_ii_deeplink/unity_project/Assets/ICP.NET/Wasmtime.Dotnet.dll.meta Deleted old ICP.NET plugin meta
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins.meta Updates Unity Assets/Plugins folder meta (plugin relocation)
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET.meta Adds/updates meta for the new ICP.NET plugin directory
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/API.xml.meta Updates plugin metadata
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/BouncyCastle.Cryptography.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/EdjCase.ICP.Agent.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/EdjCase.ICP.BLS.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/EdjCase.ICP.Candid.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/EdjCase.ICP.WebSockets.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/Microsoft.Bcl.HashCode.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/System.Buffers.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/System.Formats.Asn1.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/System.Formats.Cbor.dll.meta Updates plugin metadata for new ICP.NET location
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/System.Memory.dll.meta Adds plugin metadata for new ICP.NET dependency
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/System.Numerics.Vectors.dll.meta Adds plugin metadata for new ICP.NET dependency
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/System.Runtime.CompilerServices.Unsafe.dll.meta Adds plugin metadata for new ICP.NET dependency
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/UnityHttp.cs Adds Unity-specific HTTP adapter code for ICP.NET
native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/UnityHttp.cs.meta Updates/creates meta for UnityHttp.cs
native-apps/unity_ii_deeplink/unity_project/Assets/Scripts/DelegationUtils.cs Makes delegation model types [Serializable] for Unity JsonUtility
native-apps/unity_ii_deeplink/unity_project/Assets/Scripts/ICPAgent.cs Adds renamed/updated Unity agent script with new inspector-configurable URLs
native-apps/unity_ii_deeplink/unity_project/Assets/Scripts/ICPAgent.cs.meta Adds meta for the new ICPAgent script
native-apps/unity_ii_deeplink/unity_project/Assets/Scripts/TestICPAgent.cs Deletes old TestICPAgent script (renamed to ICPAgent)
native-apps/unity_ii_deeplink/unity_project/Assets/Scripts/TestICPAgent.cs.meta Deletes meta for old TestICPAgent script
native-apps/unity_ii_deeplink/unity_project/Assets/Scenes/SampleScene.unity Rewires scene to use ICPAgent and updated UI labels/callbacks
native-apps/unity_ii_deeplink/unity_project/Assets/link.xml Adds linker config to prevent IL2CPP stripping of ICP.NET assemblies
native-apps/unity_ii_deeplink/unity_project/Assets/link.xml.meta Updates meta for linker config
native-apps/unity_ii_deeplink/unity_project/Packages/manifest.json Adds Unity package manifest (dependencies list)
native-apps/unity_ii_deeplink/unity_project/ProjectSettings/EditorBuildSettings.asset Ensures SampleScene is included in build settings
native-apps/unity_ii_deeplink/unity_project/ProjectSettings/PackageManagerSettings.asset Updates Unity package registry URL and internal IDs
native-apps/unity_ii_deeplink/unity_project/ProjectSettings/ProjectVersion.txt Updates Unity editor version
native-apps/unity_ii_deeplink/unity_project/ProjectSettings/SceneTemplateSettings.json Adds scene template dependency settings
native-apps/unity_ii_applink/README.md Deletes the separate App Links variant README (consolidation)
native-apps/unity_ii_applink/ii_integration_dapp/.gitignore Deletes App Links legacy dfx/webpack ignore rules
native-apps/unity_ii_applink/ii_integration_dapp/Makefile Deletes App Links legacy dfx Makefile
native-apps/unity_ii_applink/ii_integration_dapp/README.md Deletes App Links legacy dfx documentation
native-apps/unity_ii_applink/ii_integration_dapp/canister_ids.json Deletes App Links legacy canister ids
native-apps/unity_ii_applink/ii_integration_dapp/dfx.json Deletes App Links legacy dfx.json
native-apps/unity_ii_applink/ii_integration_dapp/package.json Deletes App Links legacy package.json
native-apps/unity_ii_applink/ii_integration_dapp/src/greet_backend/main.mo Deletes App Links legacy backend
native-apps/unity_ii_applink/ii_integration_dapp/src/greet_frontend/assets/.ic-assets.json Deletes App Links legacy .ic-assets.json
native-apps/unity_ii_applink/ii_integration_dapp/src/greet_frontend/assets/.well-known/assetlinks.json Deletes App Links assetlinks.json (now documented in consolidated example)
native-apps/unity_ii_applink/ii_integration_dapp/src/greet_frontend/assets/main.css Deletes App Links legacy css
native-apps/unity_ii_applink/ii_integration_dapp/src/greet_frontend/assets/sample-asset.txt Deletes App Links sample asset
native-apps/unity_ii_applink/ii_integration_dapp/src/greet_frontend/src/index.html Deletes App Links legacy html
native-apps/unity_ii_applink/ii_integration_dapp/src/greet_frontend/src/index.js Deletes App Links legacy js
native-apps/unity_ii_applink/ii_integration_dapp/webpack.config.js Deletes App Links webpack config
native-apps/unity_ii_applink/unity_project/.gitignore Deletes App Links Unity project gitignore
native-apps/unity_ii_applink/unity_project/Assets/Editor/AndroidPostBuildProcessor.cs Deletes App Links variant Android post-build processor
native-apps/unity_ii_applink/unity_project/Assets/Editor/AndroidPostBuildProcessor.cs.meta Deletes meta for that processor
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET.meta Deletes legacy embedded ICP.NET directory meta
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/README.md Deletes legacy ICP.NET README
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/README.md.meta Deletes meta for the README
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/LICENSE Deletes legacy embedded ICP.NET license
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/LICENSE.meta Deletes meta for the license
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/BouncyCastle.Cryptography.dll.meta Deletes old plugin meta
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/System.Formats.Asn1.dll.meta Deletes old plugin meta
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/System.Runtime.CompilerServices.Unsafe.dll.meta Deletes old plugin meta
native-apps/unity_ii_applink/unity_project/Assets/ICP.NET/Wasmtime.Dotnet.dll.meta Deletes old plugin meta
native-apps/unity_ii_applink/unity_project/Assets/Scripts/DelegationUtils.cs Deletes legacy delegation model types (moved/updated in consolidated example)
native-apps/unity_ii_applink/unity_project/Assets/Scripts/DelegationUtils.cs.meta Deletes meta
native-apps/unity_ii_applink/unity_project/Assets/Scripts/DeepLinkPlugin.cs Deletes legacy deep link plugin implementation
native-apps/unity_ii_applink/unity_project/Assets/Scripts/GreetingClient.cs Deletes legacy generated client
native-apps/unity_ii_applink/unity_project/Assets/Scripts/GreetingClient.cs.meta Deletes meta
native-apps/unity_ii_applink/unity_project/Assets/Scripts/TestICPAgent.cs Deletes legacy TestICPAgent
native-apps/unity_ii_applink/unity_project/Assets/Scripts.meta Deletes meta
native-apps/unity_ii_applink/unity_project/Assets/Scenes.meta Deletes meta
native-apps/unity_ii_applink/unity_project/Assets/Scenes/SampleScene.unity.meta Deletes scene meta
native-apps/unity_ii_applink/unity_project/Assets/test.keystore.meta Deletes keystore meta
native-apps/unity_ii_applink/unity_project/ProjectSettings/AudioManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/AutoStreamingSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/ClusterInputManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/DynamicsManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/EditorBuildSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/EditorSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/GraphicsSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/MemorySettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/NavMeshAreas.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/PackageManagerSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/Physics2DSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/PresetManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/ProjectVersion.txt Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/TagManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/TimeManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/UnityConnectSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/VFXManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/VersionControlSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_applink/unity_project/ProjectSettings/boot.config Removes legacy Unity boot config file
native-apps/unity_ii_universallink/README.md Deletes the separate Universal Links variant README (consolidation)
native-apps/unity_ii_universallink/ii_integration_dapp/.gitignore Deletes Universal Links legacy ignore rules
native-apps/unity_ii_universallink/ii_integration_dapp/Makefile Deletes Universal Links legacy Makefile
native-apps/unity_ii_universallink/ii_integration_dapp/README.md Deletes Universal Links legacy documentation
native-apps/unity_ii_universallink/ii_integration_dapp/canister_ids.json Deletes Universal Links legacy canister ids
native-apps/unity_ii_universallink/ii_integration_dapp/dfx.json Deletes Universal Links legacy dfx.json
native-apps/unity_ii_universallink/ii_integration_dapp/package.json Deletes Universal Links legacy package.json
native-apps/unity_ii_universallink/ii_integration_dapp/src/greet_backend/main.mo Deletes Universal Links legacy backend
native-apps/unity_ii_universallink/ii_integration_dapp/src/greet_frontend/assets/main.css Deletes Universal Links legacy css
native-apps/unity_ii_universallink/ii_integration_dapp/src/greet_frontend/assets/sample-asset.txt Deletes Universal Links sample asset
native-apps/unity_ii_universallink/ii_integration_dapp/src/greet_frontend/src/index.html Deletes Universal Links legacy html
native-apps/unity_ii_universallink/ii_integration_dapp/src/greet_frontend/src/index.js Deletes Universal Links legacy js
native-apps/unity_ii_universallink/ii_integration_dapp/src/universallink_website/assets/.ic-assets.json Deletes Universal Links legacy .ic-assets.json
native-apps/unity_ii_universallink/ii_integration_dapp/src/universallink_website/assets/main.css Deletes Universal Links legacy website css
native-apps/unity_ii_universallink/ii_integration_dapp/src/universallink_website/src/index.html Deletes Universal Links legacy website html
native-apps/unity_ii_universallink/ii_integration_dapp/src/universallink_website/assets/.well-known/apple-app-site-association Deletes Universal Links AASA file (now documented in consolidated example)
native-apps/unity_ii_universallink/ii_integration_dapp/webpack.config.js Deletes Universal Links webpack config
native-apps/unity_ii_universallink/unity_project/.gitignore Deletes Universal Links Unity project gitignore
native-apps/unity_ii_universallink/unity_project/README.md Deletes Universal Links Unity project readme
native-apps/unity_ii_universallink/unity_project/Assets/Editor/iOSPostBuildProcessor.cs Deletes legacy Universal Links iOS post build processor
native-apps/unity_ii_universallink/unity_project/Assets/Editor/iOSPostBuildProcessor.cs.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/Editor.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET.meta Deletes legacy embedded ICP.NET directory meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/README.md Deletes legacy ICP.NET README
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/README.md.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/LICENSE Deletes legacy license
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/LICENSE.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/BouncyCastle.Cryptography.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/EdjCase.ICP.Agent.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/EdjCase.ICP.BLS.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/EdjCase.ICP.Candid.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/Microsoft.Bcl.HashCode.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/System.Formats.Asn1.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/System.Formats.Cbor.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/System.Runtime.CompilerServices.Unsafe.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/ICP.NET/Wasmtime.Dotnet.dll.meta Deletes old plugin meta
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/DelegationUtils.cs Deletes legacy delegation model types
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/DelegationUtils.cs.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/DeepLinkPlugin.cs Deletes legacy deep link plugin
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/DeepLinkPlugin.cs.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/GreetingClient.cs Deletes legacy generated client
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/GreetingClient.cs.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/TestICPAgent.cs Deletes legacy TestICPAgent
native-apps/unity_ii_universallink/unity_project/Assets/Scripts/TestICPAgent.cs.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/Scripts.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/Scenes.meta Deletes meta
native-apps/unity_ii_universallink/unity_project/Assets/Scenes/SampleScene.unity.meta Deletes scene meta
native-apps/unity_ii_universallink/unity_project/Assets/test.keystore.meta Deletes keystore meta
native-apps/unity_ii_universallink/unity_project/ProjectSettings/AudioManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/AutoStreamingSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/ClusterInputManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/DynamicsManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/EditorBuildSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/EditorSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/GraphicsSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/MemorySettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/NavMeshAreas.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/PackageManagerSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/Physics2DSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/PresetManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/ProjectVersion.txt Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/TagManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/TimeManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/UnityConnectSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/VFXManager.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/VersionControlSettings.asset Deletes legacy Unity ProjectSettings file
native-apps/unity_ii_universallink/unity_project/ProjectSettings/boot.config Removes legacy Unity boot config file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread native-apps/unity_ii_deeplink/icp.yaml
Comment thread native-apps/unity_ii_deeplink/unity_project/Assets/Scripts/DeepLinkPlugin.cs Outdated
Comment thread native-apps/unity_ii_deeplink/ii-bridge/src/main.js
- ICPAgent.cs: disable Sign-In button during async Ed25519 key generation
  to prevent null dereference if user taps before SessionIdentity is ready
- DeepLinkPlugin.cs: replace System.Web.HttpUtility.UrlDecode (unavailable
  in Unity's .NET Standard 2.1) with Uri.UnescapeDataString
- UnityHttp.cs: fix awaiter race where continuation() is called before
  OnCompleted sets it — invoke continuation immediately if already done
- ii-bridge/package.json: declare @noble/hashes as an explicit dependency
  rather than relying on the transitive resolution from @icp-sdk/*

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 201 out of 253 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

native-apps/unity_ii_deeplink/unity_project/Assets/Editor/iOSPostBuildProcessor.cs:20

  • With the URL scheme changing to org.dfinity.unity-ii, PatchPlist’s current implementation is not idempotent: if CFBundleURLTypes already exists (incremental builds or other plugins), the else-branch later in this file does not ensure the new scheme is present, so the deep-link callback may not work. Consider updating the existing CFBundleURLTypes array to add the scheme when missing (and fix the nearby comment typo “shceme”).

- UnityHttp.cs: guard continuation?.Invoke() in OnRequestCompleted to
  prevent NullReferenceException when request completes before OnCompleted
  sets the continuation (completes the race fix from the previous commit)
- DeepLinkPlugin.cs: defer cold-start deep link processing via coroutine
  until ICPAgent.SessionIdentity is ready, preventing a null dereference
  when the app is launched directly from the callback URL
- iOSPostBuildProcessor.cs: implement the else branch so the URL scheme
  is added to an existing CFBundleURLTypes array on incremental builds;
  fix "shceme" typo in comment

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo

Copy link
Copy Markdown
Member Author

Re the suppressed low-confidence comment on iOSPostBuildProcessor.cs: the else branch (which was just a TODO comment) has been implemented in 72966a4 — it now walks the existing CFBundleURLTypes array and adds the scheme if not already present, making PatchPlist idempotent on incremental builds. The "shceme" typo is also fixed.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 201 out of 253 changed files in this pull request and generated 4 comments.

Comment thread native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/UnityHttp.cs Outdated
- ICPAgent.cs: preflight check for empty greetBackendCanister before
  calling Principal.FromText() — avoids misleading "session expired"
  message when the Inspector field is simply not configured
- DeepLinkPlugin.cs: guard SignIn() against empty iiBridgeUrl to surface
  a clear error instead of opening an invalid URL
- UnityHttp.cs: fix GetUri to accept absolute URLs (avoids constructing
  "https://ic0.app/https://..." when a full URL is passed); wire up
  cancellationToken.Register(request.Abort) in both GetAsync and PostAsync

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 201 out of 253 changed files in this pull request and generated 3 comments.

Comment thread native-apps/unity_ii_deeplink/unity_project/Assets/Plugins/ICP.NET/UnityHttp.cs Outdated
marc0olo and others added 2 commits July 13, 2026 19:24
- Awaiter: use read-and-clear pattern (c = continuation; continuation = null;
  c?.Invoke()) in OnRequestCompleted, and clear before invoking in OnCompleted's
  isDone path — prevents double-invocation when both paths race to call the
  continuation (introduced by combining the round-2 isDone fix with the
  round-3 null-guard fix)
- GetAsync / PostAsync: dispose CancellationTokenRegistration via `using var`
  so the abort callback and captured request are released as soon as the
  request completes (introduced when cancellation support was added in round 3)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- ICPAgent.cs: fix "My Princinpal" typo in GameObject.Find (was silently
  returning null because the name didn't match the scene object)
- SampleScene.unity: rename matching GameObject to "My Principal"
- ICPAgent.cs: wrap async void Start() body in try/catch so a key-gen
  failure shows a user-visible error instead of leaving the sign-in
  button permanently disabled
- DeepLinkPlugin.cs: add 10 s timeout to HandleColdStartDeepLink so the
  coroutine does not hang forever if key generation fails
- DeepLinkPlugin.cs: add null guard for mIcpAgent at the top of
  OnDeepLinkActivated to handle the Awake/Start ordering gap
- TESTING.md: remove stale note that the iOS plist processor only runs
  on first build (the else-branch was fixed in an earlier commit)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 201 out of 253 changed files in this pull request and generated 2 comments.

- DeepLinkPlugin.cs: add null guard after GetComponent<ICPAgent>() in
  Start(); disable the MonoBehaviour and log an error when the component
  is not found, preventing a NullReferenceException in
  HandleColdStartDeepLink
- ICPAgent.cs: disable the Greet button for the duration of
  CallCanisterGreet to prevent re-entrant concurrent calls; re-enable on
  success (DelegationIdentity = null in the catch already handles the
  failure path via the property setter)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo

Copy link
Copy Markdown
Member Author

Re: Copilot review #4687271561

Both findings fixed in 1027c7f:

  • DeepLinkPlugin.cs — missing ICPAgent guard: Added a null check after GetComponent<ICPAgent>() in Start(). When the component is not found the plugin logs an error, sets enabled = false, and returns — preventing the NullReferenceException in HandleColdStartDeepLink.

  • ICPAgent.cs — re-entrant greet: The Greet button is now disabled at the start of CallCanisterGreet and re-enabled on success. The failure path already handles button state via the DelegationIdentity setter (DelegationIdentity = null disables the Greet button and shows the sign-in button), so no duplicate state management is needed there.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 201 out of 253 changed files in this pull request and generated 1 comment.

Comment thread native-apps/unity_ii_deeplink/ii-bridge/src/main.js
Wrap actor.greet() in try/catch/finally so the button is always
re-enabled via finally, and a transient network or replica error shows
a message in the UI instead of leaving the button permanently disabled.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo

Copy link
Copy Markdown
Member Author

Re: Copilot review #4687916242

Fixed in c386915 — wrapped actor.greet() in try/catch/finally. The finally block always re-enables the button, and the catch block logs the error and shows a message in the UI so the user can retry.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 201 out of 253 changed files in this pull request and generated 3 comments.

Comment thread native-apps/unity_ii_deeplink/icp.yaml
Comment thread native-apps/unity_ii_deeplink/unity_project/README.md Outdated
- ICPAgent.cs: replace the hardcoded "Session expired — sign in again."
  catch message with the actual exception message so configuration
  errors (wrong icGateway, wrong canister ID) are distinguishable from
  auth failures
- unity_project/README.md: correct the DeepLinkPlugin description —
  the code uses local ToHex/FromHex helpers, not Convert.ToHexString/
  Convert.FromHexString, because those methods require .NET 5+ and
  Unity targets .NET Standard 2.1

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@marc0olo

Copy link
Copy Markdown
Member Author

Re: Copilot review #4688062661

Fixed in b08d616:

  • ICPAgent.cs — misleading error message: Replaced the hardcoded "Session expired — sign in again." with "Greet failed: " + e.Message so configuration errors (wrong icGateway, wrong canister ID) are distinguishable from authentication failures.

  • unity_project/README.md — wrong hex API reference: Corrected the DeepLinkPlugin description. The code uses local ToHex/FromHex helpers, not Convert.ToHexString/Convert.FromHexString, because those methods require .NET 5+ which is not available in Unity's .NET Standard 2.1 runtime.

  • icp.yaml — missing .icp/data/ directory: Intentional. The example does not commit canister IDs from previous deployments — each developer runs icp deploy to get their own canister IDs and sets them via the Unity Inspector as documented in the README. Committing .icp/data/ would bind the example to specific canister instances that other developers cannot access.

@raymondk raymondk merged commit 6414181 into master Jul 13, 2026
6 checks passed
@raymondk raymondk deleted the chore/migrate-unity-ii-to-icp-cli branch July 13, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Examples audit: restructure for docs integration (educational assessment)

3 participants