二手车网站怎么做的,广州小程序开发多少钱,网站热图分析,微网站内容原地址#xff1a;http://www.cnblogs.com/qingjoin/p/3638915.html Unity 3D 简单工程的创建。与Xcode 导出到iOS 平台请看这 Unity3D 学习 创建简单的按钮、相应事件 Unity C# 代码 using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;pu… 原地址http://www.cnblogs.com/qingjoin/p/3638915.html Unity 3D 简单工程的创建。与Xcode 导出到iOS 平台请看这 Unity3D 学习 创建简单的按钮、相应事件 Unity C# 代码 using UnityEngine;
using System.Collections;
using System.Runtime.InteropServices;public class testFeil : MonoBehaviour {[DllImport(__Internal)]private static extern void c_ctest();// Use this for initializationvoid Start () {}// Update is called once per framevoid Update () {}void OnGUI() { //开始按钮 创建了一个按钮。 if(GUI.Button(new Rect(20,100,200,50),qingyun )) { //System.Console.WriteLine(hello world);print(hello qingyun !);c_ctest(); // Debug.Log(up.up);} } void testResult (string msg){Debug.Log(testResult: msg);}//这个是C#里的一个回调。用来接收数据是否传送成功。----这里的作用就是OC里的回调。void testBtnResult (string msg){Debug.Log (btnPressSuccessssssssssss:msg);}
} .mm 文件里的OC 与 C 接口 //
// MeiyuPushSdkC.m
// MeiYuPushDemo
//
// Created by qingyun on 3/31/14.
// Copyright (c) 2014 qingyun. All rights reserved.
//#import MeiyuPushSdkC.h
#import MeiyuPushSdk.hinterface MeiyuPushSdkC : NSObjectMeiyuPushSdkDelegateendimplementation MeiyuPushSdkC- (id)init
{id object [super init];[[MeiyuPushSdk my_initPush]setDelegate:self];//sdk.delegate self;NSLog(initMeiyuPushSdkC);return object;
}-(void)cTestResult
{UnitySendMessage(Main Camera, testBtnResult, 成功啦.哇哈哈哈);
}endMeiyuPushSdkC *m_pushSdk NULL;#if defined (__cplusplus)
extern C
{
#endifvoid c_ctest(){if(m_pushSdk NULL){m_pushSdk [[MeiyuPushSdkC alloc]init];}MeiyuPushSdk *m [MeiyuPushSdk my_initPush];//objc_msgSend(obj, selector(setName:),balabala);[m cTest];NSLog(testSuccess---------);UnitySendMessage(Main Camera, testResult, -10862904$_^_$接口调用失败);}#if defined (__cplusplus)
}
#endif 这样就把Unity3d 与OC 连到了一起。 具体可参考 unityFile.zip 转载于:https://www.cnblogs.com/123ing/p/3821811.html