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.

Resolved Why timer works in editor but not in build?

Discussion in 'Visual Scripting' started by Dudusstar, May 25, 2021.

  1. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    Hi! So I have my game almost finished (puzzle game for android) and I decided to add a last minute info for the players: the number of total tries and the total played time (what a big mistake).

    The thing is that it works perfectly in the editor but once I build the game, the UI text in my android does not show the time. Does not work in other devices either.

    So my set up is:

    1.- I got this object that calculates fixed delta time in each level and add it to variable "time" (picture1).

    1.PNG

    2.- Then when the level finishes takes this "time" and add it to "total time" (picture2).

    2.PNG

    3- Finally this "total time" is converted in seconds, minutes and hours and showed up in the finish level pop up UI.

    3.PNG

    First I try to add some delays (timers) between nodes to give it time to calculate and adding all the data in the variables but did not work.

    I've read in some forums that maybe it's because of the fix delta time, in others that the reason is because of the round. I've tried fixed delta time and fixed update and nothing works.

    What do you think? Can anyone have a clue about the reason is not working in the build version?

    Thanks for your time and help again!!
     
  2. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,026
    Fixed Update and Fixed Delta time should only be used when physics are involved. For simple numerical time calculations you should use regular Update with regular delta time. Or Bolt's "Per Second" nodes as an alternative to the delta time multiplication.
     
    Dudusstar likes this.
  3. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    Thank you so much for your answer and support.

    Ok, I understand. So I used per second to calculate the time but only works in editor. Once I build it does not work.

    Here you have the new flow machine and I'm using "update"

    4.PNG
     
  4. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,026
    Could be a bug specific to the build. I'd report the issue to Unity.
     
    Dudusstar likes this.
  5. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    Ok, thank you so much for the support. I will do that!
     
  6. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    Soooo, somebody gave me a solution for this:

    "Try running Tools/Bolt/AoT Pre-build--this may be in Project Settings in later builds."
     
  7. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59
    Hi again, I've finally find a solution for this:

    "I ran Tools/Bolt/AoT Pre-build--this may be in Project Settings in later builds."
     
  8. PanthenEye

    PanthenEye

    Joined:
    Oct 14, 2013
    Posts:
    1,026
    Glad you sorted it out!
     
    Dudusstar likes this.
  9. Dudusstar

    Dudusstar

    Joined:
    Nov 19, 2020
    Posts:
    59