MENU

flort値を時間表示にする備忘録(Unity PlayMaker)

何らかのfloat値を「3:33」みたいに表示するための備忘録

【INIT】ステート

特になし

【DISPLAY】ステート

【Get Fsm Float】
float値を取得し「time」に入れる。

【Int Operator】
取得した「time」をintにコンバートして60で割り、minutesに入れる。

【Int Operator】
「minutes」に60を掛け「remainder」に入れる。

【Float Operator】
「time」を「remainder」で引き「seconds」に入れる。

【Convert Float To String】
「seconds」を「secondsText」に変換する。その際、フォーマットを「00」にする。

【Convert Int To String】
「minutes」を「minutesText」に変換する。その際、フォーマットを「00」にする。

【Build String】
「String Parts」を3にする。
「Element 0」に「minutesText」
「Element 1」に「:」
「Element 2」に「secondsText」をセット。
「setText」に入れる。

【UI Text Set Text】
表示したい場所のUI TEXTに「setText」を入れて表示させて完成!

プログラマーじゃなくてもゲーム作れるよ!

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!

コメント

コメント一覧 (12件)

  • When I originally commented I clicked the “Notify me when new comments are added” checkbox and now each time a comment is added I get several emails with the same
    comment. Is there any way you can remove me from that service?
    Cheers!

  • My spouse and I absolutely love your blog and find the majority of your post’s
    to be precisely what I’m looking for. Would you offer guest writers to write content for
    yourself? I wouldn’t mind writing a post or elaborating on a few of the subjects
    you write related to here. Again, awesome site!

    • Thank you for your wonderful comment.
      I write this site at my own pace, and my English is extremely poor, so I rely on machine translation.
      Honestly, I’m not sure if I’m reading your comment correctly.
      So it’s very difficult to be a guest writer.

      This site is updated at my own pace, but I would be happy if you could continue reading it.

  • An impressive share! I’ve just forwarded this onto a coworker who
    has been doing a little homework on this.
    And he in fact bought me breakfast simply because I found it
    for him… lol. So allow me to reword this…. Thank YOU
    for the meal!! But yeah, thanks for spending some time to talk about this matter here on your web page.

    • Thank you for sharing the article.
      Playing the game I created will also contribute to our activities!
      Best regards.

  • Greetings! I just finished reading this blog post and felt compelled to leave a comment. Your analysis on this subject was spot-on and gave me a lot to think about. I appreciate the time and effort you put into creating such valuable content. Looking forward to more posts from you!

    • Thank you for reading the article! If you’re looking to display time using PlayMaker, I recommend using the ‘Convert Seconds To String’ method—it’s much easier than the steps described in the article!

コメントする

目次