Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created December 28, 2020 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todorok1/7793fe1879bfd1eae60408ac29bb6af3 to your computer and use it in GitHub Desktop.
Save todorok1/7793fe1879bfd1eae60408ac29bb6af3 to your computer and use it in GitHub Desktop.
MathfのClampでintが返ってくる
/// <Summary>
/// 引数で指定された値がClampメソッドを通してどの値になるかを確認します。
/// </Summary>
void ClampTest(int value)
{
int min = 0;
int max = 10;
int clamped = Mathf.Clamp(value, min, max);
Debug.Log($"{value} を入力した結果、Clampを通した値は {clamped} でした。");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment