ABOUT THIS PODCAST

the game design experience
English
United States
14 episodes
since May, 2014

LATEST EPISODE

How to get “share on social” in Unity

I’m writing this post because a reference solution for how to create a Unity button that allows to “share on social” text and images, opening the default “pick a social” screen on mobile apps does not seem to be sufficiently indexed, so my colleague Matteo Bicocchi and I had to struggle in order to put together a complete solution. Here I just re-post information we found elsewhere (in different posts) together with a linear procedure, so I hope to save time for some of you reading 90% of the solution is simply getting this library unity-native-sharing from GitHub and following its setup instructions, in our case the only resulting call is: NativeShare.Share(I18n.T("SHARE_GRAFFITI_BODY"), mediaPath, null, I18n.T("SHARE_GRAFFITI_SUBJECT"), "image/jpg"); Before finding this simple solution we went through a nightmarish set of experiments that half worked, Android manifest conflicts and Android Studio bizzarries, all stuff that using the above plugin will spare you. The only case the plugin doesn’t cover is this: on IOS, Instagram by default does not appear among the apps with which you can share your image (it does by default on Android). But the integration to get also Instagram is below. Special handling for sharing to Instagram on IOS For solving the Instagram case we used a different “plugin” that you can deploy together with the one above; it is just a header and implementation (2 files) and a bridge call from Unity, of the kind if (Application.platform == RuntimePlatform.IPhonePlayer) { InstagramShare.PostToInstagram(I18n.T("SHARE_GRAFFITI_SUBJECT"), LocalScreenshot.EncodeToPNG()); } else { NativeShare.Share(I18n.T("SHARE_GRAFFITI_BODY"), mediaPath, null, I18n.T("SHARE_GRAFFITI_SUBJECT"), "image/jpg"); } Now this will still not work by default (you will be warned by XCode on run) because of a permission problem: canOpenURL: failed for URL: “instagram://app” – error: “This app is not allowed to query for scheme instagram” Again here is the solution, which is to edit the plist file in XCode. And below there is how to automate the plist change from Unity: put this code in a class saved in an Editor folder:  [PostProcessBuild]  public static void ChangeXcodePlist(BuildTarget buildTarget, string pathToBuiltProject)     {         if (buildTarget == BuildTarget.iOS)         {           [... other changes ...]             // Change value of CFBundleVersion in Xcode plist             PlistElementArray array = rootDict.CreateArray("LSApplicationQueriesSchemes");             array.AddString("instagram");                        // Write to file             File.WriteAllText(plistPath, plist.WriteToString());         }     } That’s all. So thank you so much to the solvers of the three problems above, and you should now have a complete solution. Follow me on Twitter where I post about game design, game development, Unity3d, applied / serious games.   The post How to get “share on social” in Unity appeared first on Design a Game.
Disclaimer: The podcast and artwork embedded on this page are from » Podcasts, which is the property of its owner and not affiliated with or endorsed by Listen Notes, Inc.

CLAIM THIS PODCAST

Why to claim podcasts?

If you are a podcaster, the best way to manage your podcasts on Listen Notes is by claiming your Listen Notes podcast pages. It is a great, free way to engage the podcast community and increase the visibility of your podcasts.
After claiming your Listen Notes podcast pages, you will be able to:
Manually refresh the RSS feed to sync up
Get a verified badge (
Claimed
) alongside with your podcast name on Listen Notes
Indicate intention of looking for sponsorship, guests, co-hosts, cross-promotion...
Coming soon:
Self-service promotion on Listen Notes
Use speech-to-text techniques to transcribe your show and edit transcripts
Improve the presence of your podcasts, e.g., self served podcaster interview...
Respond to listener comments on Listen Notes
Track your podcast stats on Listen Notes, e.g., listens, page views...
Manage episodes

EDIT

Thank you for helping to keep the podcast database up to date.