コード例 #1
0
    IEnumerator SendWebRequest()
    {
        PongScore newScore = new PongScore {
            PlayerName = "Lantigua", Score = 200
        };

        www = UnityWebRequest.Put(WebServiceURL, JsonUtility.ToJson(newScore));
        www.SetRequestHeader("content-type", "application/json");
        yield return(www.SendWebRequest());

        Debug.Log(www.downloadHandler.text);
    }
コード例 #2
0
    void Start()
    {
        rb          = GetComponent <Rigidbody>();
        ballRespawn = GetComponent <BallRespawn>();

        playerTarget = GameObject.Find("PlayerTarget");
        enemyTarget  = GameObject.Find("EnemyTarget");
        smashTarget  = GameObject.Find("SmashTarget");

        grabPongBat = GameObject.Find("GetBat-Col").GetComponent <GrabPongBat>();
        pongscore   = GameObject.Find("MainGameLogic").GetComponent <PongScore>();
        pongEnemy   = GameObject.Find("EnemyBat").GetComponent <PongEnemy>();

        startPos = gameObject.transform.position;
    }