//tips
//unity連動簡易ECサイト表示
先に作成した簡易ECサイトをunityに表示させていく。
Webviewを起動し、画面いっぱいに表示させる初期の方法で対応していく。3d空間でwebview対応させることはできないことは以前検証済み。
下記の形に戻し、グーグル画面が正常に表示されることを確認。
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class WebViewSample : MonoBehaviour
{
WebViewObject webViewObject;
void Start()
{
webViewObject = (new GameObject("WebViewObject")).AddComponent<WebViewObject>();
webViewObject.Init(
ld: (msg) => Debug.Log(string.Format("CallOnLoaded[{0}]", msg)),
enableWKWebView: true);
#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
webViewObject.bitmapRefreshCycle = 1;
#endif
// お好きなMarginにしてください
webViewObject.SetMargins(100, 100, 100, 100);
webViewObject.SetVisibility(true);
// お好きなURLにしてください
webViewObject.LoadURL("https://www.google.co.jp");
}
void OnGUI()
{
GUI.enabled = webViewObject.CanGoBack();
if (GUI.Button(new Rect(10, 10, 80, 80), "<"))
{
// ブラウザ:前のページへ
webViewObject.GoBack();
}
GUI.enabled = true;
GUI.enabled = webViewObject.CanGoForward();
if (GUI.Button(new Rect(100, 10, 80, 80), ">"))
{
// ブラウザ:次のページへ
webViewObject.GoForward();
}
GUI.enabled = true;
}
}
GoogleのURL部分にショップサイトのアドレスであるhttp://localhost/shop/shop_list.phpを入れてあげるときちんと表示された。
きちんと会員ログインもでき最終決済画面までたどり着くことができた。
またphp myadminにもunity側で注文した内容がきちんと反映されていた。
ここからはunityでの3decショップに対する討論記事を見ていく。
https://forum.unity.com/threads/e-commerce-in-unity.188968/
Unity applications run on the client side so you would have to loop through all ecommerce actions with WWW to a php webservice as a direct database connection is definitely not an option.
DBとの直接のやりとりは考えられず、WWW to a php webserviceのループとなるとのこと。
On the iPhone I don't think such a thing makes sense at all due to the regulations in relation to "what the user pays is payed to apple be it app buying or inapp storekit"
支払いはappleまたはアプリ内下記となるので現実的ではない。WWW to a php webserviceとサーバの関係を理解する必要がある。
As dreamora said, you'd have to do everything through php and a web server. You'd be better served with something like appcelerator, which is a similar concept (a meta-framework for app development) but lets you build iphone/droid apps using common web-based technologies(php, asp, javascript, html and mysql).
php and a web serverを用いて構築の全てをしなければならず、それならunityではなく別物を使用した方がいい。基本的にはunityで3d ecサイトを作成は可能であるが効果的ではないよう。イタリアでは作成者がいるらしい。
But you can not use the HTTP requests from .NET, so also not correspondingly related service functionality. You would really do distinct requests and parse in / out data.
unityでは HTTP requests from .NETが使えないことに配慮する必要がある。
it is not the holy grail that most would expect unless you have the freedom of doing a standalone and being in a safe environment, cause in this case you can really unleash it (direct DB connection etc)
データベースとunityの関係性についての理解が必要そう。unityとサーバとの間の問題をうまくハンドリングしないと使えないが、そこに力を割く必要性があるのかが問われているのかもしれない。
他のshopifyやappceleratorを調べてみたが3dワールドは見つけることができなかった。
https://www.publickey1.jp/blog/13/appceleratorappcelerator_platformbaasoracle.html
https://help.shopify.com/ja/manual/products/product-media/3d-warehouse
https://www.shopify.jp/blog/3d-models-video
https://netshop.impress.co.jp/node/6729