Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by JonCarroll · Jun 01, 2012 at 05:15 PM · iospluginnativegl

Low-level native plugin on iOS

I have been trying to get a low native plugin working on iOS but I never seem to get the UnitySetGraphicsDevice or UnityRenderEvent callbacks. I am using modified example code from here and am receiving the SetTimeFromUnity native call but not the two rendering related callbacks. I also confirmed that GL.IssuePluginEvent is being called in my unity project but UnityRenderEvent is never called in response.

Has anyone had any luck getting the low-level interface working on iOS? Is there some sort of trick? The sample with the documentation implies it only works on Windows/Mac.

EDIT: Some clarification

I actually have native calls working fine. I was wanting info specifically on the low level rendering callbacks you can receive that were added in 3.5 (UnitySetGraphicsDevice or UnityRenderEvent callbacks) that are described in the link in my post. I need to make some native OpenGL draw calls outside of Unity and going forward using those callbacks is the only way to assure I get the callback on the rendering thread. Right now I can make the OpenGL draw calls on the same thread that I make native calls on but when multi-threading is added to iOS Unity in the future (as it currently works on Windows) I will need those low level graphics calls to work to ensure I do my drawing on the correct thread.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image zephlabs · Sep 05, 2015 at 07:42 PM 0
Share

Did you solve this problem? I'm trying to build an iOS native plugin that will do some OpenGL rendering and I am concerned about not being on the render thread as well. I can't seem to find any complete examples for iOS.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Siney · Jul 30, 2016 at 10:04 PM

From Unity 4.5, you have to register the event.

"iOS: Added support for render events (GL.IssuePluginEvent). Please note that you need to manually register them, as iOS do not support dynamic libraries. Check trampoline for UnityRegisterRenderingPlugin function."

For example:

import

import "UnityAppController.h"

extern "C" void UnitySetGraphicsDevice(void* device, int deviceType, int eventType); extern "C" void UnityRenderEvent(int marker);

@interface MyAppController : UnityAppController { } - (void)shouldAttachRenderDelegate; @end

@implementation MyAppController

  • (void)shouldAttachRenderDelegate; { UnityRegisterRenderingPlugin(&UnitySetGraphicsDevice, &UnityRenderEvent); } @end So you just have to do some editing of UnityAppController.mm after you build the project. If you do "Append" it will leave your edits in place.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Native Alert on iOS (plugin) 1 Answer

Native GUI-Style on IOS 2 Answers

How to get local currency u3dxt 1 Answer

Access photos, videos & music from iOS and Android library? 0 Answers

Creating a native photo picker screen on iOS 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges