Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

InvalidOperationException: Cannot access child value on Newtonsoft.Json.Linq.JValue

$
0
0
Hello, I am making a game using AirConsole plugin, but when i try to move the player with the AirConsole joystick this error happens: InvalidOperationException: Cannot access child value on Newtonsoft.Json.Linq.JValue This is my code to move the player: using System.Collections; using System.Collections.Generic; using UnityEngine; using NDream.AirConsole; using Newtonsoft.Json.Linq; public class GameLogic : MonoBehaviour { public GameObject playerGO; public float playerSpeed; private Vector2 moveVector; private void Awake() { AirConsole.instance.onMessage += OnMessage; } private void OnMessage(int from, JToken data) { InputHandler(data); } private void InputHandler(JToken data) { moveVector = new Vector3(data["joystick-left"]["message"]["x"].Value("x"), 0, data["joystick-left"]["message"]["y"].Value("y")); } private void Update() { playerGO.transform.Translate(moveVector); } private void OnDestroy() { AirConsole.instance.onMessage -= OnMessage; } } Thanks.

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>