Closed LuoLuoDev closed 1 year ago
doCreateSurface in MTLSwapchain.m on iOS Platform @minggo looking forward to your reply, thx very much.
The program created with cocos should be a separate program. It can not be reentered. Even implement doCreateSurfaceView can not fix it, as engines codes use singleton object in many places.
The program created with cocos should be a separate program. It can not be reentered. Even implement doCreateSurfaceView can not fix it, as engines codes use singleton object in many places.
Got it, I have encountered the need to enter the cocos page multiple times. Currently, I refer to the implementation of doInit to implement the doCreateSurfaceView interface, and use the WindowRecreated event to trigger it. When the last cocos page receives dealloc, it will call logic similar to applicationWillTerminate in this class of AppDelegateBridge. In addition, I also did:
above is all i did to try to make reentering possible. If you have any suggestions, please let me know.
Except singleton object, there are many static variables too. And script system is not friendly to enter cocos page multiple times. As I said, currently games created by cocos is not designed to be entered multiple times. You may modify engine to do it, but it is very hard. And I don't know how to do it correctly.
Thx for your patient reply. Btw,you just mentioned script system is not friendly, do you mean v8 or jsbridge communication module?
I mean two things:
Got it. Currently, I processed them like this:
Use Case
I use cocos creator on the iOS platform to nest the cocos view on the native page, and can repeatedly enter the cococ view page.
Problem Description
I found that there is an implementation of the doCreateSurface interface on the Android platform, but there is no corresponding implementation on the iOS platform. This This has led to inconsistencies between functions on the Android and iOS platforms.
Proposed Solution
I would like to ask whether the doCreateSurface interface of the iOS platform will be implemented in the near future.
How it works
No response
Alternatives Considered
maybe you can clear the old metallayer and its resource when pause event happend, and then repalce with the new metallayer new page when resume event happened.
Additional Information
No response