LoginSignup
12
8

More than 5 years have passed since last update.

メモ クラス名・メソッド名・クラス内行数の表示

Last updated at Posted at 2014-06-04

Eclipseに出力するとStackTraceの行数見えないのでDebug.Logに仕込んでおこう

クラス名 this.GetType().FullName

メソッド名 System.Reflection.MethodBase.GetCurrentMethod().Name

行数 new System.Diagnostics.StackFrame(0, True).GetFileLineNumber()

まとめるとこんな感じ、colorのところのスペースは省いてください

Debug.Log("< color=red>■クラス名:< /color>" + this.GetType().FullName + "< color=yellow>メソッド名:< /color>" + System.Reflection.MethodBase.GetCurrentMethod().Name + "< color=green>行数:< /color>" + new System.Diagnostics.StackFrame(0, true).GetFileLineNumber().ToString());

12
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
8