Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

Help with Acceleration

Discussion in 'Scripting' started by KryKrycz, May 26, 2018.

  1. KryKrycz

    KryKrycz

    Joined:
    Mar 11, 2018
    Posts:
    9
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5. public class AccelerometerMove : MonoBehaviour {
    6.  
    7.     // Use this for initialization
    8.     void Start () {
    9.        
    10.     }
    11.  
    12.     // Update is called once per frame
    13.     void Update() {
    14.         int temp = Input.acceleration.x;
    15.         Debug.Log (temp);
    16.     }
    17. }
    18.  




    I dont know what is wrong :[
     
  2. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
    Try using a float, i think it goes 0-1 maybe?
     
  3. KryKrycz

    KryKrycz

    Joined:
    Mar 11, 2018
    Posts:
    9
    Can u please send me script ? Please
     
  4. SparrowGS

    SparrowGS

    Joined:
    Apr 6, 2017
    Posts:
    2,536
  5. Billy4184

    Billy4184

    Joined:
    Jul 7, 2014
    Posts:
    5,983
    How are you testing the phone accelerometer input? Do you have your phone connected using Unity Remote?
     
  6. KryKrycz

    KryKrycz

    Joined:
    Mar 11, 2018
    Posts:
    9
    OMG thx !! No it doesnt show error. Thx so much