Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,22 @@ crashlytics-build.properties
.DS_Store

# Ignore Assets/Vuplex because it's paid asset
/[Aa]ssets/Vuplex/
/[Aa]ssets/Vuplex/

# Node.js
node_modules/
dist/
*.tgz

# IDE
.vscode/
.idea/

# Debug logs
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Local development
.env
.env.local
12 changes: 6 additions & 6 deletions Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -513,11 +513,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_AnchorMax.x
value: 1
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_AnchorMax.y
value: 1
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_AnchorMin.x
Expand All @@ -529,11 +529,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_SizeDelta.x
value: 0
value: 160
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_SizeDelta.y
value: 0
value: 340
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_LocalPosition.x
Expand Down Expand Up @@ -565,11 +565,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 80
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: 170
objectReference: {fileID: 0}
- target: {fileID: 224179541092979990, guid: 3e10f3b6a733e441c8352020cff2f1f6, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
Expand Down
35 changes: 33 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,24 @@ flowchart LR

With WebView RPC, method calls between C# and JavaScript behave like regular function calls, significantly reducing the need for repetitive JSON parsing and bridge implementations. This structure becomes even more maintainable as the project scales.

## Examples
### Unity Example
Clone this whole repository.
> [!NOTE]
> Require [Viewplex Webview Asset(paid asset)](https://assetstore.unity.com/publishers/40309?locale=ko-KR&srsltid=AfmBOoqtnjTpJ-pw_5iGoS88XRtGX-tY2eJmP86PYoYCOhxrvz1OXRaJ) to run sample.
### Javascript Example
[webview_rpc_sample](https://github.com/kwan3854/Unity-WebViewRpc/tree/main/webview_rpc_sample)
```bash
# 1. Move to sample directory
cd webview_rpc_sample

# 2. Install dependencies
npm install

# 3. Build project
npm run build
```

## Installation

### Adding WebView RPC to a Unity Project
Expand Down Expand Up @@ -84,9 +102,22 @@ With WebView RPC, method calls between C# and JavaScript behave like regular fun
```

### Adding WebView Library
#### Install
```bash
npm install app-webview-rpc
```

- WebView RPC is not distributed as a package.
- Add the files under [Unity-WebViewRpc/WebViewRpcJS/RuntimeLibrary](https://github.com/kwan3854/Unity-WebViewRpc/tree/main/WebViewRpcJS/RuntimeLibrary) to your JavaScript project.
#### Usage
```javascript
import { VuplexBridge, WebViewRpcClient, WebViewRpcServer } from 'app-webview-rpc';

// RPC client
const bridge = new VuplexBridge();
const rpcClient = new WebViewRpcClient(bridge);

// RPC server
const rpcServer = new WebViewRpcServer(bridge);
```

### Installing the protobuf Compiler

Expand Down
18 changes: 18 additions & 0 deletions README_ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ flowchart LR
이처럼 WebView RPC를 사용하면 C#과 JavaScript 간 상호 호출이 단순 함수 호출처럼 동작하며, 반복되는 JSON 파싱/Bridge 처리를 크게 줄일 수 있습니다.
프로젝트 규모가 커질수록 이 구조가 훨씬 간결하고 유지보수하기 쉬워집니다.

## 샘플 프로젝트 제공
### Unity Example
Clone this whole repository.
> [!NOTE]
> 샘플을 실행하기 위해서는 [Viewplex Webview Asset(유료)](https://assetstore.unity.com/publishers/40309?locale=ko-KR&srsltid=AfmBOoqtnjTpJ-pw_5iGoS88XRtGX-tY2eJmP86PYoYCOhxrvz1OXRaJ)이 필요합니다.
### Javascript Example
[webview_rpc_sample](https://github.com/kwan3854/Unity-WebViewRpc/tree/main/webview_rpc_sample)
```bash
# 1. Move to sample directory
cd webview_rpc_sample

# 2. Install dependencies
npm install

# 3. Build project
npm run build
```

## 설치
### 유니티 프로젝트에 WebView RPC 추가하기
1. Nuget 패키지 매니저를 통해 `Protobuf` 패키지를 설치합니다.
Expand Down
3 changes: 3 additions & 0 deletions webview_rpc_runtime_library/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
src/
tsconfig*.json
.gitignore
Loading