Coder Social home page Coder Social logo

ercarousel's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

ercarousel's Issues

你好,看过你的博客,iOS整合Unity遇到问题请教

iOS端内部嵌入了两款AR的游戏,进入不同的场景使用 UnitySendMessage("Controller", "OpenSence",data);传递不同的参数,但是只有第一次启动他才能进入其中一个,当进入第二个发送新的消息时还是会显示第一个的游戏画面,iOS端Unity是无法关闭的,后来测试加入 UnityLoadApplication();
Profiler_InitProfiler();
切换偶尔是正常的,但有时候会显示错乱,麻烦看下
(void)showUnityWindow {

if (_didResignActive) {

    UnityPause(false);
}
_didResignActive = NO;

UnityLoadApplication();
Profiler_InitProfiler();

self.window.hidden =YES;
self.unityWindow.hidden = NO;
[self.unityWindow makeKeyWindow];

}

  • (void)hideUnityWindow {

    UnityPause(true);
    _didResignActive = YES;
    Profiler_UninitProfiler();

    self.unityWindow.hidden = YES;
    self.window.hidden = NO;
    [self.window makeKeyWindow];
    }

发送消息代码:

  • (void)wjBtnDidClicked {

    [kAppDelegate showUnityWindow];

    [self toUnityPageWithValue:@"wj"];
    }

  • (void)scenesBtnDidClicked {

    [kAppDelegate showUnityWindow];

    [self toUnityPageWithValue:@"scenes"];
    }

#pragma mark - 跳转到对应的Unity页面

  • (void)toUnityPageWithValue:(NSString *)value {

    // TODO: 新增代码
    //报错SendMessage: object Controller does not have receiver for function openSence! 说明UnitySendMessage传递的对象不具备相应的方法

    const char *data = [value UTF8String];

    /**
    你那边需要打开场景的话 需要 传值给 OpenSence这个函数 通过ios给unity对象传值的方式 值有两个 "wj" 和 ”scenes“

    "Controller" "openSence" "wj 或者 scenes"
    */

    UnitySendMessage("Controller", "OpenSence",data);
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.