纳金网

标题: CS调用js脚本变量 [打印本页]

作者: 狂风大尉    时间: 2015-2-28 20:15
标题: CS调用js脚本变量

using System.Reflection;// 反射      (需要加入头文件)

  Offset = GetComponent(“MainBoardTopJS”);

  FieldInfo OffsetXFieldInfo = Offset.GetType().GetField(“OffsetX”);

  OffsetX = (float)OffsetXFieldInfo.GetValue(Offset);

  ----------或----------------------------------------------------

  using System.Reflection;// 反射      (需要加入头文件)

  Component X;

  FieldInfo OffsetXFieldInfo;

  X = GetComponent(“ToAngleAxis”);

  OffsetXFieldInfo = X.GetType().GetField(“rotationX”);

  rotationX = (float)OffsetXFieldInfo.GetValue(X);

  ----------------------------------------------------------------------

  using System.Reflection;// 反射

  Component Offset = GetComponent(“MainBoardTopJS”);

  FieldInfo OffsetXFieldInfo = Offset.GetType().GetField(“OffsetX”);

  OffsetX = (float)OffsetXFieldInfo.GetValue(Offset);





欢迎光临 纳金网 (http://www.narkii.com/club/) Powered by Discuz! X2.5