Comments (5)
そもそもコルーチンがエディタ拡張で使えなさそう
from quiche-pantie-patch-unity-editor.
この辺使えるのでは?
https://www.shibuya24.info/entry/2017/04/18/000000
https://github.com/baobao/EditorImgLoader
from quiche-pantie-patch-unity-editor.
そもそもOnUpdateでエディタをフレーム更新する処理が必要だったっぽい
private void OnEnable (){
EditorApplication.update += Update;
}
...
private static void Update(){
if(_iEnumerator != null){
//コルーチンを実行
_iEnumerator.MoveNext();
}
}
from quiche-pantie-patch-unity-editor.
ここを参考にエディタのフレーム更新処理を追加するも問題直らず😭
In develop
branch
Assets/AliceLaboratory/Editor/PantiePatchEditorWindow.cs
private void OnEnable() {
EditorApplication.update += Update;
}
/// <summary>
/// GUI setting
/// </summary>
private void OnGUI() {
using(new GUILayout.VerticalScope()) {
if(GUILayout.Button("パンツ一括ダウンロード")) {
Download();
}
}
}
private void Update() {
if (_iEnumerator != null) {
while (_iEnumerator.MoveNext()) { Debug.Log("Running coRoutine..."); }
}
}
private void Download() {
Debug.Log("Start coRoutine");
var com = new Communication();
// コルーチンの作成
_iEnumerator = com.GetTexture(FinishDownload);
}
private void FinishDownload() {
_iEnumerator = null;
}
Assets/AliceLaboratory/Editor/Communication.cs
public class Communication {
private const string URL = "http://pantie-patch.herokuapp.com/api/convert/anna/0101.png?add_sign=true";
FileCreator creator;
public IEnumerator GetTexture(Action callback) {
UnityWebRequest www = UnityWebRequestTexture.GetTexture(URL);
www.timeout = 5;
yield return www.SendWebRequest();
// リクエストが完了するまで待機
while(!www.isDone) {
yield return 0;
}
if(www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
} else {
// テクスチャデータを保存
Texture tex = ((DownloadHandlerTexture)www.downloadHandler).texture;
creator = new FileCreator();
creator.Create(tex);
}
callback();
}
}
from quiche-pantie-patch-unity-editor.
ここで while
ループ使ってたのが問題だったっぽい。
ループさせないようにしたらいけた。
そもそもUpdateで毎フレーム更新してるのにループさせた結果、フレームが更新されなくなってフリーズしたのが原因
// before
private void Update() {
if (_iEnumerator != null) {
while (_iEnumerator.MoveNext()) { Debug.Log("Running coRoutine..."); }
}
}
// after
private void Update() {
if (_iEnumerator != null) {
_iEnumerator.MoveNext();
}
}
from quiche-pantie-patch-unity-editor.
Related Issues (11)
- テクスチャ重ね合わせ機能の実装 HOT 1
- Utilityの追加実装
- テクスチャの重ね合わせ処理が正常に機能しない HOT 2
- パンツ画像のダウンロードとAssetとして保存する機能の作成 HOT 1
- VRCSDK3-AvatarでUniTaskを使うとConcurrentQueueがVRCCore-Editorとmscorlibの両方を参照してしまう HOT 3
- Gatewayっていう名前が抽象的で分かりにくい HOT 1
- 例外処理必要ない説 HOT 1
- パンツデータDLをローカルとの差分を見て更新分だけDLするようにする
- 最新のモデルデータをAPIから取得できる機能の実装 HOT 1
- Unitypackage を自動生成するCI環境の構築 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quiche-pantie-patch-unity-editor.