当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Unity3D & ObjC : Call API in .cs file from .m/.mm file

问题描述:

I don’t know how to call function in .cs file from .m file.

Example:

// In file MotoState.cs

public class MotoState : MonoBehaviour {

public static void setMotors()

{

// do something here

}

public static void getMotors()

{

// call function in AppDelegate from here

}

}

// In .m file

@interface UnityAppController : NSObject<UIApplicationDelegate>

{

}

+(void)callSetMotors;

+(void)callThisFromGetMotors;

  1. How to call setMotors() function in .cs file from callSetMotors() function in .m file ?
  2. How to call callThisFromGetMotors() function in .m file from getMotors() in .cs file ?

Here no object reference required. All are static function.

分享给朋友:
您可能感兴趣的文章:
随机阅读: