Search Unity

Noticeable Different in PSM Build VS. In Editor Build

Discussion in 'PSM' started by fryedrycestyle, Aug 2, 2014.

  1. fryedrycestyle

    fryedrycestyle

    Joined:
    Jun 8, 2012
    Posts:
    19
    Hi,

    So I'm working on a music game, with Playstation Mobile as one of my target platforms.

    Its a beatmatching game similar to BeatMania or Guitar Hero. For the past few days I've had trouble getting the notes to sync up with the music properly. And now I've finally gotten that working... in the editor.

    My problem now is its not remotely in sync in my DevAssistant build.

    This is the code that pushes the notes down the screen after they're spawned:

    Code (CSharp):
    1. void pushNotes () {
    2.         _currentR = (1000.0f * Time.time) - _startingTime;
    3.  
    4.         for (int n = 0; n < _activeOne.Count; n++) {
    5.          
    6.             double elapsedR = Mathf.Abs((float) (_previousR -  _currentR));
    7.  
    8.             Vector3 updatedPos = _activeOne[n].transform.position;
    9.          
    10.             updatedPos.y -= (_trackSpeed) * (float) elapsedR;
    11.             _activeOne[n].transform.position = updatedPos;
    12.         }
    13.  
    14.         _previousR = (1000.0f * Time.time) - _startingTime;
    15.  
    16.         // Left
    17.         _currentL = (1000.0f * Time.time) - _startingTime;
    18.      
    19.         for (int n = 0; n < _activeTwo.Count; n++) {
    20.             double elapsedL = Mathf.Abs((float) (_previousL -  _currentL));
    21.          
    22.             Vector3 updatedPos = _activeTwo[n].transform.position;
    23.          
    24.             updatedPos.y -= (_trackSpeed) * (float) elapsedL;
    25.          
    26.             _activeTwo[n].transform.position = updatedPos;
    27.         }
    28.      
    29.         _previousL = (1000.0f * Time.time) - _startingTime;
    30.     }
    31.  
    Its called from the Update() method.

    Like I said, this works fine in the Editor, but on my Vita there is a noticeable delay from the notes hitting te "now" bar / strike bar.

    What might account for this? I spawn the notes off the screen at Y = 2000. Notes are 2D sprites where 1 unit = 1 pixel.

    Thanks!
     
    Last edited: Aug 2, 2014
  2. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    Theres many things that it could be,
    - Try changing the Update to FixedUpdate()
    - Are you testing the Unity editor version as the same screen resolution as the vita?
    Screen Shot 2014-08-02 at 12.09.39.png

    - Or perhaps there is lag on the ps vita that is caused by a bad shader, add a frames per second display as a gui text whilst the games running on the vita.
     
  3. fryedrycestyle

    fryedrycestyle

    Joined:
    Jun 8, 2012
    Posts:
    19
    1) There's no noticeable difference when using FixedUpdate() vs Update().
    2) Works fine in editor at PS Vita resolution.
    3) The framerate is, on average, comparable on both (~300 FPS) but it jumps around A LOT more in the editor (from ~250 - ~600).

    I'm quite stumped! Anyone else have any suggestions?
     
  4. jesusluvsyooh

    jesusluvsyooh

    Joined:
    Jan 10, 2012
    Posts:
    377
    How are you detecting note hits? Triggers? Rays?
     
  5. fryedrycestyle

    fryedrycestyle

    Joined:
    Jun 8, 2012
    Posts:
    19
    EDIT: Fixed it. =]

    I was using Yield WaitForNewSeconds() instead of WaitForFixedUpdate() on my coroutines. That fixed it.
     
    Last edited: Aug 3, 2014
    PeterD likes this.
  6. PeterD

    PeterD

    Joined:
    Feb 6, 2013
    Posts:
    120
    :oops::oops:
    Lol I've. Hit that gotcha before. Took me a whole day to work out what was happening.