• Learn
    • Code Lab
    • Foldables and Large Screens
    • One UI Beta
  • Develop
    • Mobile/Wearable
    • Galaxy GameDev
    • Galaxy Themes
    • Galaxy Watch
    • Health
    • Samsung Blockchain
    • Samsung DeX
    • Samsung IAP
    • Samsung Internet
    • Samsung Pay
    • Samsung Wallet
    • View All
      • Galaxy AR Emoji
      • Galaxy Accessory
      • Galaxy Edge
      • Galaxy Z
      • Galaxy Performance
      • Galaxy FM Radio
      • Galaxy S Pen Remote
      • Galaxy Sensor Extension
      • PENUP
      • Samsung Automation
      • Samsung Neural
      • Samsung TEEGRIS
      • Samsung eSE SDK
      • Galaxy Watch for Tizen
      • Watch Face Studio
      • One UI Watch for Tizen
      • Galaxy Watch Studio Converter
      • Samsung IAP for Galaxy Watch (Tizen)
    • Visual Display
    • Smart TV
    • Smart Hospitality Display
    • Smart Signage
    • Digital Appliance
    • Family Hub
    • Platform
    • Bixby
    • Knox
    • SmartThings
    • Tizen.NET
  • Design
    • Design System
    • One UI
    • One UI Watch
    • Smart TV
  • Distribute
    • Galaxy Store
    • TV Seller Office
    • Galaxy Store Games
    • Instant Plays
  • Support
    • Developer Support
    • Remote Test Lab
    • Samsung Android USB Driver
    • Galaxy Emulator Skin
  • Connect
    • Blog
    • News
    • Forums
    • Events
    • Samsung Developer Conference
    • SDC23
    • SDC22
    • SDC21
    • SDC19 and Previous Events
  • Sign In
Top Global Search Form
Recommendation
  • Blog
  • Code Lab
  • Foldable and Large Screen Optimization
  • Forums
  • Galaxy Emulator Skin
  • Galaxy GameDev
  • Health
  • Remote Test Lab
  • SDC22
  • Watch Face Studio
All Search Form
Recommendation
    Suggestion
      All Search Form
      Filter
      Filter
      Filter
      • ALL (57)
      • DOCS
      • SDK
      • API REFERENCE
      • CODE LAB
      • BLOG
      • NEWS/EVENTS
      • OTHERS
        api reference code lab blog news/events
      1. featured | mobile, galaxy watch

      blog

      Features of the Samsung Developers Portal that You Might've Missed

      note: content was updated on 9 february 2023 to correct information about the podcast. hello everyone! my colleagues are still on holiday, enjoying socially-distant vacations and staycations. while they're on hikes in the sierra mountains and swimming in backyard pools, i'll continue on from my post last week. we made big changes to the layout and function of the samsung developers site in january, so if you haven't explored the site in detail, here are some highlights. d'ya like games? if you're a game developer or have interest in developing games in the future, you'll want to investigate the galaxy gamedev section of the site. our colleagues in the gamedev team are building useful tools for optimizing games so they'll run great on galaxy phones, tablets, as well as other android devices. the gamedev team is updating their content frequently, so if you want to get the most out of your game projects, check back often. if you have existing game titles and you're interested in expanding your user base, spend some time in the galaxy store games section to learn how to list your games (and other apps) in galaxy store. you can also learn how to use samsung's in-app purchase (iap) sdk for new ways to increase your revenue. what's up, docs? we know, what you're looking for is information and ways to develop faster and smarter. a developer site would not be complete without reams of technical documentation describing the apis and tools. that's all there, again, with new ways to view and access the information. most every tool or sdk listed on the top navigation bar has documentation affiliated with it. after choosing a topic from the navigation bar, often you can access the documentation by clicking the "get started" button in the header image, or by scrolling down the page and looking for the specific api you are interested in. for example, if you're looking for information on optimizing your apps for foldable devices, use the main navigation bar to go to build > mobile and then click the galaxy fold icon partway down the page. test, test, & test when you're ready to test your app on a real device, you have a couple of options. the remote test lab allows you to test real devices in labs located in asia, north america, and europe. this includes the latest devices like the galaxy z flip or galaxy s20, as well as galaxy watch and galaxy tab devices. if you have a galaxy android device, you can test locally with your mac, linux, or windows device using the android platform sdk tools. windows users will need to install the samsung-specific usb drivers, which can be found on the developer portal. feed me, again i mentioned the rss feed features of discourse in my earlier post. if it's not obvious, i really enjoy the convenience and consistency of reading my day's worth of news all within one app. if i find an article or topic that i want to read in more depth, i'll click the heading and go to the site in my mobile browser or save it for later reading on the desktop. here, you can see that i can read all the latest posts from android enthusiast sites, the ny times, and our very own product teams. the link to the samsung developers portal (sdp) rss feed can be found at the footer of every page, or you can simply add https://developer.samsung.com/feed to your favorite rss reader. we got you covered if you have a question that can't be answered in the public forums, you can request support through the portal dashboard. if you log into the site using your samsung account id, you can submit a ticket to our developer support team. to check on the status of your ticket and read feedback, visit the dashboard support page. in addition to submitting and viewing support tickets, the portal dashboard is your gateway to special partner benefits. for example, if you're a registered galaxy themes or galaxy watch creator, you can use the dashboard to access tools, services, and sdks for developing new content. from the dashboard, you can also sign up for our monthly newsletter or withdraw membership from the developer program altogether. pow! while it's not exactly a feature of the site, it's an example of the ways we're trying to reach developers. my colleague tony morelan started working on a new podcast earlier this year. tony's guests are a mix of samsung thought leaders and successful galaxy store sellers. tony has a lot of enthusiasm for design and he's always searching for his next great topic. give him a listen on your favorite podcasting app or by visiting our podcast archive. we still 💙 feedback i hope you're enjoying the new layout and design of the site. if you have suggestions (or even bug reports), hop into the feature requests section of the forums and let me know. thank you for being a samsung developer.

      Eric Cloninger

      https://developer.samsung.com/sdp/blog/en-us/2020/07/15/features-of-the-samsung-developers-portal-that-you-mightve-missed
      1. events | mobile, game

      blog

      Join Samsung At The Game Developers Conference

      we are thrilled to be part of the game developers conference (gdc) 2019 at the moscone convention center in san francisco from march 18-22. join us in person or online for our expert-led sessions on a full range of game development hot topics. here’s a sneak preview: a quick look inside your game: gpuwatch & gamesdk (presented by samsung) learn how to create high-performance gaming experiences with ease using gpuwatch. in this session, you will hear the announcement about gamesdk and optimization practices with unity based mobile games. galaxy gamedev: bringing maximum boost to mobile games learn how samsung helps game developers optimize games faster with new technologies like vulkan and by working together with game developers tightly to give a real contribution to the game development process. samsung & google present: how to develop games for foldables games are now being played on more than just mobile devices. consumers demand versatility, and broader device landscape is fueling the shift to a more immersive gameplay. learn how leading developers address multiple surfaces and form factors like the new samsung foldable. grow reach and engagement with the latest techniques. how to get your game on samsung galaxy learn how samsung will help game developers deliver better experiences to their customers. hear from thomas ko, vp of service partnership, samsung electronics co. ltd., on how game developers can prepare themselves for this special opportunity to become part of the galaxy store. the session will also include important information about game launcher which will help people easily can access games. how to make use of new vulkan features discover recent developments in the vulkan api and ecosystem. you will leave this session with better insight into day to day development with vulkan, and how game developer needs drive where the api goes next. bringing fortnite to mobile with vulkan and opengl es learn the strategies that epic and samsung found effective when developing a rendering api interface to bring high-end games to android devices. get the best practices for optimal vulkan performance when targeting the latest generation of mobile socs. download fortnite from galaxy store. all-in-one guide to vulkan on mobile (presented by samsung and arm) learn about codified best practices for vulkan and how they impact performance in mobile, with specific game examples. megacity on mobile: how we optimized it with adaptive performance join us for the joint samsung / unity session in the unity booth on thursday at 11:45am – 12:15pm. we hope to see you there!

      Samsung Developer Program

      https://developer.samsung.com/sdp/blog/en-us/2019/02/20/join-samsung-at-the-game-developers-conference
      1. Distribute
      2. Galaxy Store Games

      doc

      Start Selling in Galaxy Store

      get started in galaxy store the following is a list of tasks (required, recommended, and optional), videos, and recommended reading to help you start selling your apps in galaxy store. a link to more detailed information is provided, when available. the icons represent the following: required task recommended task optional task video recommended reading prepare before you do anything, sign up for a samsung account. using your samsung account, you can register with samsung developers and seller portal and apply for commercial seller status. then, understand what you need to do if you are submitting your app to more than one app store, and review the online resources provided by galaxy gamedev. register with seller portal (downloadable pdf). seller portal is used to manage your applications that are distributed in galaxy store. if you want to sell your app in galaxy store, you must have a seller portal account. the seller portal user guide provides more information about seller portal registration. also, watch the video about how to create a seller portal account. apply for commercial seller status (downloadable pdf). in seller portal, you must apply for commercial seller status. the seller portal user guide provides more information about commercial seller status. review apk package naming and billing guidelines. when you are submitting a game or app to more than one app store, you need to keep track of the package name and/or version codes you use in your apk for each app store and, if you have in-app purchases, the billing solution used. add a galaxy store review link. get feedback from your customers by adding a link from your app to your app's review page in galaxy store. positive feedback can influence users to purchase your app. explore the samsung developers portal. samsung developers portal provides access to sdks, services, tools, and guides. you can also sign up for a newsletter that keeps you up-to-date with the latest blogs, news, and events. register using your samsung account. how to create a seller portal account. seller portal is used to manage your applications that are distributed in galaxy store. if you want to sell your app in galaxy store, you must have a seller portal account. explore the seller portal dashboard. check out the top level menus, learn some of the basic tasks, and discover where to find additional information and support for seller portal. learn about samsung seller portal. a basic overview of the major features in seller portal. learn about galaxy gamedev. review technical support options for game developers. monetize learn about requirements for in-app items and paid apps. integrate with samsung in-app purchase (iap) (downloadable pdf). if you are selling your app and/or in-app items, you must use samsung iap as your billing solution. samsung iap includes an sdk, guides, examples, and unity and unreal plugins. maximize your revenue with samsung in-app purchase. learn about the new features and improvements released in samsung in-app purchase (iap) 6.0. monetize your games with samsung in-app purchase. introduction to samsung iap plug-in functionality for unity and unreal game engines. learn more about samsung iap. review the online samsung iap documentation. make the most from your games. discover different ways to generate revenue in galaxy store. launch register your app and in-app items in seller portal, test your app, then launch your app in galaxy store. all apps must be reviewed and approved by samsung before they are distributed to galaxy store for sale. noteare you a developer of a popular game on galaxy smartphones? we can help you go live in five minutes in galaxy store. contact us to learn more about our fast app review process. register your app in seller portal (downloadable pdf, by app type: android, galaxy themes). how to register your app in seller portal, based on the app type. the seller portal user guide provides more information about app registration. pre-certify your app. if you are working with the samsung business development team, your new apps or major updates must be pre-certified. pre-certification helps to uncover issues before an app is submitted to galaxy store. if no issues are found, pre-certification can take around five days to complete. review the app distribution guide. ensure that your app meets samsung's requirements and standards of quality to pass publication review. set a publication date. determine when your app becomes available in galaxy store. your app can be published when it passes an initial review, on a set date, or you can manually control the release of your app. in seller portal, set the publication date in the publication tab using the start publication field. beta test your app. learn how to deploy your app for beta testing and receive valuable feedback from testers. test your in-app item transactions. test your samsung iap integration, such as in-app item offering, purchase, and payment functionality. available for closed beta testing only. get started in instant plays 2.0. bring users directly from an ad click into your game. using our mobile cloud gaming platform, your game becomes instantly available and accessible to all compatible samsung galaxy devices. publish in five minutes. contact us to find out if your games qualify for our fast app review process. review the seller portal user guide. review information about seller portal. use the galaxy store developer api. learn how to manage your apps and in-app items and view statistics about your apps programmatically. seller portal android app binary registration device resolution. lists the device resolutions most used by customers in galaxy store. this is a required field when you register your android app in seller portal. manage in-app items. read more about how to manage your in-app items in seller portal. test your app on a samsung device. test your app on the latest samsung galaxy devices using remote test lab. understand the review process. check out the steps samsung takes to review your app. level up after you app is published in galaxy store, learn more about tracking performance metrics, promoting your app, and tracking user data. engage on social media. promote your content and attract new customers using our social media kits, hashtags, and guidelines. create galaxy store badges. directly link users from your web site or social media channels to your app product detail page. generate badges from seller portal after the publication of your app. request promotion for your galaxy themes. promote your app and increase your downloads by being included in a collection in galaxy store. discover user attribution data. identify how a user finds your app's detail page in galaxy store using galaxy store statistics. integrate with third-party attribution platforms. track user data using third-party attribution platforms integrated with galaxy store. become familiar with galaxy store statistics. galaxy store statistics (gss) is a tool that is included with seller portal and allows you to see the performance metrics of all your apps. learn about the valuable data available to you in gss. u.s. partner onboarding guidelines the pdf content provided on this page was taken from the u.s. partner onboarding guidelines. for your convenience, the entire guideline is provided in a single downloadable pdf for each app type. you must log in or be logged in to your samsung account to download these pdfs. u.s. partner onboarding guideline (android) 407kb (pdf) u.s. partner onboarding guideline (galaxy themes) 3.8mb (pdf)

      https://developer.samsung.com/galaxy-games/get-started-in-galaxy-store.html
      1. Develop
      2. Mobile

      web

      Mobile | Samsung Developers

      mobile get set up to use samsung mobile sdks in your apps. all things for samsung mobile galaxy sdk get started create your own applications with a variety of samsung galaxy sdks, services, and tools. galaxy ar emoji sdk create your own avatar in your app galaxy edge sdk specialized widgets for extended functions in the android view system galaxy gamedev build games for galaxy devices - the world's largest mobile gaming platform galaxy performance sdk optimize your application performance galaxy s pen remote sdk control apps remotely with your s pen galaxy themes with galaxy themes, you can personalize\ngalaxy devices’ screens galaxy z (foldable) app design guide for foldable phones health create a useful health app on galaxy watch and a smartphone penup a creative social network service for digital arts samsung application management a solution to manage background applications for better system health samsung automation studio develop your apps using samsung automation studio samsung dex build apps to control desktops with smartphones samsung blockchain build blockchain-enabled services for mobile devices samsung ese sdk provides a way for service providers to deploy services using ese on samsung devices samsung iap sdk make it possible to sell a variety of items in samsung galaxy applications samsung internet build web apps for the samsung internet browser-powering all samsung devices samsung pay integrate secure samsung pay functionalities into your mobile app or website samsung teegris a powerful solution to run applications in a trusted execution environment samsung wallet an all-in-one, single-swipe solution for tickets, boarding passes, coupons, and more samsung wireless fast charge enables samsung mobile devices to be fast-charged with the wireless fast charger experience the latest one ui with android 14 open to all users, the one ui beta program is an opportunity to try one ui features before their official release. learn more foldables and large screens new opportunities in the mobile experience. learn more new watch face design tool new opportunities for new watch devices. get started test your apps test your apps on your galaxy devices or on the emulator, or remotely. samsung android usb driver for windows samsung usb driver for mobile phones galaxy emulator skin check out the newly released emulator skins for galaxy z flip5 and galaxy z fold5. download now! remote test lab use the remote test lab to remotely access a real device online. distribute your apps reach customers in more than 180 countries through galaxy store. how to distribute use these guides and checklists to prepare your apps, themes, and watch faces for galaxy store. seller portal the seller portal site supports those who want to sell their apps on galaxy store galaxy store badge an one click link to your app detail page or brand page. social media kits social media is the most powerful tool in engaging an audience and attracting new fans.

      https://developer.samsung.com/mobile/
      1. events | mobile, game

      blog

      Develop: Brighton Recap

      last month, the samsung galaxy gamedev team attended develop: brighton – the uk’s biggest developer-focused games industry event. the sun-kissed conference showcased the best local talent, with some fantastic experiences from indies and big publishers alike. i particularly enjoyed ndreams' showcase of their upcoming vr game phantom: covert ops – it looks set to be the biggest kayaking stealth shooter of the year! samsung was out in force at the event with two business staff and two technical staff, along with yours truly. we spent most of the time having meetings on the beach in the delightfully bright sunshine. i’m leaving a note to myself that breakfast beachside chats are my new favorite way to spend a work trip! it was particularly lovely to see ex-colleagues and friends from sega, sony, jagex, miniclip, and sumo digital while hanging out in the bar. though i can't go into great detail about what we discussed behind closed doors, believe me when i say the uk has some incredible products coming to mobile over the next couple of years. i am not talking your typical hyper-casual games either – core gaming might be seeing a bit of a shakeup very soon! another show highlight was the develop: star awards, which featured industry heavy hitters like gabe newell and sean murray, and of course, many excellent games. while we were too busy networking to attend any sessions, there were many interesting topics discussed during the conference. three of the speakers that caught my eye were: in-game content generation using machine learning (raheel yawar) mmobile: bringing old school runescape to smartphones (christopher knowles) next gen vr - what developers need to know (andrew ayre/alvaro barua) it would be remiss of me not to mention the social side of develop: brighton, as it is part of what makes the conference so popular. we managed to get along to the gamesindustry.biz party on wednesday night and what a turn out it was. the warm night was filled with energy & laughter, with some excellent new connections made and far too many cheeky lemonades. i can’t tell you how grateful i was to mag interactive for providing free bacon rolls the morning after. if you were there, then thank you for being part of such a great event. if you weren’t, i strongly recommend you come along next time – i may even buy you a beachside breakfast!

      David Pither

      https://developer.samsung.com/sdp/blog/en-us/2019/08/29/develop-brighton-recap
      1. announcement | galaxy watch, mobile

      blog

      Unpacking Galaxy Unpacked: Key Takeaways for Developers and Designers (Aug 2020)

      the latest edition of galaxy unpacked was held on wednesday, august 5th, and for the first time it was virtual. we unveiled five new devices that empower work and play. galaxy unpacked featured lots of exciting updates for our designer and developer community, and what was mystery became mystic (bronze). you can watch the full livestream on youtube, or fast forward to these time codes for key moments 8:50 galaxy note20 and note20 ultra 53:45 galaxy watch3 1:08:01 galaxy z fold2 be sure to check out our galaxy watch3 artboards, now available on the galaxy store asset creator. and now, here are the key takeaways on each of the new devices unveiled at galaxy unpacked. galaxy note20 and note20 ultra the galaxy note20 series is a productivity powerhouse that works like a computer and lets users game like a pro. the series comes in two versions: galaxy note20 ultra, designed for note fans who demand the ultimate in power and productivity, and galaxy note20, for those note users looking to maximize their time for work and play. the galaxy note20 series includes the ever-popular s pen. developers, you can leverage the s pen remote sdk, s pen framework, and air actions to enhance the experience of your apps and games. as part of our continued partnership with microsoft, xbox game pass is coming to galaxy store. with an xbox game pass ultimate subscription, users will be able to play their favorite xbox games in the cloud (beta) right from their galaxy device. galaxy users are always looking for new games to play, so be sure to submit your own game to galaxy store. if your game has in-app items for sale, be sure to check out the samsung in-app purchase sdk which lets users transact with any of the payment methods associated with their samsung account, including samsung pay and samsung rewards. we also have numerous technical resources and best practices on optimizing your game and getting the most out of the device gpu in galaxy gamedev. we also unveiled the new wireless version of samsung dex. as samsung dex becomes even easier to use, you'll want to ensure your apps are optimized for samsung dex. our resources detail how to add multi-window support, handle runtime configuration changes, and support different input modes. galaxy watch3 the galaxy watch3 is a next-generation companion for managing routines, smashing fitness goals, and taking ownership over health. built with premium materials and a slimmed-down version of the popular rotating bezel, galaxy watch3 features the craftsmanship of a luxury timepiece, while still being comfortable enough to wear all day and all night. developers can build tizen-based apps while designers can build watch faces with galaxy watch studio to enhance and customize the user's experience. we will begin reviewing new watch face designs starting next week, but you can get a head start on the requirements now. as we mentioned, a new version of the galaxy store asset creator, which includes the galaxy watch3, is now available. new lifestyle photo assets featuring the galaxy watch3 are available as well. the new galaxy watch3 runs tizen 5.5. developers can check out this video tutorial to learn what is new in tizen 5.5. galaxy z fold2 last, but certainly not least, was the galaxy z fold2. this device builds on the experience of both the galaxy fold and the galaxy z flip to deliver unique foldable experiences. more details about the galaxy z fold2 will be released on september 1st. in the meantime, check out our resources on designing and optimizing for foldable devices. wrap up we also showcased the galaxy tab s7 and s7+, devices where your apps and games will be featured in galaxy store. the galaxy buds live introduced a new shape for wireless earbuds, an ergonomic design that’s being described as the perfect fit. can't get your hands on a physical device? stay tuned to our news feed - we'll announce when the new devices are available in our remote test lab. we can't wait to see what you create for these new devices. make sure to join us on the developer forums to share what you're working on and get your questions answered. catch up on all of yesterday's announcements on the samsung newsroom or watch the replay on youtube.

      Lori Fraleigh

      https://developer.samsung.com/sdp/blog/en-us/2020/08/06/unpacking-galaxy-unpacked-key-takeaways-for-developers-and-designers-aug-2020
      1. events | mobile, ai, iot

      blog

      The Dev Discourse – A Daily Roundup from #SDC18 Day 2

      today we wrapped up #sdc18 on a high note! day two started off with a spotlight session featuring a panel with the creators from two of the world’s most popular games, fortnite and pokémon go. if you didn’t get a chance to tune in live, you can catch the replay. the action continued on the floor with lots of activity at the samsung pen, smartthings and bixby booths, just to name a few. there was no shortage of learning and collaboration, as developers made the most of their time at #sdc18. here are the highlights from today: positioning samsung to be a game changer with more than 2 billion gamers in the world, samsung is committed to creating a future where the hundreds of millions holding a samsung device are also holding a game controller. today they showed their support towards helping developers bring the mobile gaming experience to the next level. samsung announced that in the next year galaxy gamedev will expand to include even more cutting-edge tools to help developers create more immersive and unique experiences for gamers. to help bring a high-fidelity, console-like game experience to mobile phones, the vulkan api was enhanced to offer 10 percent improved performance compared to the opengl es. another improvement is the gpuwatch that will allow developers to measure graphics performance and view on-screen information while gaming in real-time. this insight into game performance will help developers optimize their games more efficiently and easily. it was also announced that the all-new galaxy store, set to launch in 2019, will become the single destination for all digital items related to galaxy devices. this will make it easier for gaming partners to deliver their latest creations to fans, as well as more convenient for consumers to discover and download everything from new games to apps. along with its key partnerships with some of the world’s biggest game companies such as epic games, square enix and niantic inc., samsung has built an unparalleled mobile gaming platform that makes having fun on the go easier than ever. samsung talking about #gaming @tkomobile says our engineers might not be fluent in english but they speak your language! #sdc18 pic.twitter.com/u7adfrwkwc— carolina milanesi (@caro_milanesi) november 8, 2018 creating a more intelligent pen stylus today it was announced that the s pen remote sdk is now available for integration with apps. developers can use the s pen’s remote-control feature to provide a unique experience in apps. and the best part is that it’s very easy to code. with the help of developers, samsung is planning to take the stylus pen from writing tool to a multi-purpose tool. from cameras to games, the possibilities are endless! additionally, wacom joined the stage and announced their wacom ink layer language, will 3.0, to help take digital ink to the next level. will 3.0 brings augmented reality, 3d creation and digital data to the drawings of users. combined with the power of ar technology on note9, users can turn their sketches into 3d renderings. will 3.0 is also ai ready, capturing all relevant data needed for deep learning. the technology captures the semantics and biometric information from the ink, creating a more personal digital experience. together with will 3.0, samsung is able to add a more personal touch to its devices. with the help of bixby users will be able to search through their notes with voice commands. and combined with the samsung pass, will 3.0 is adding a layer of intelligence to digital authentication. it’s biometric signature id can even track the history of signatures! it’s safe to say that samsung and wacom are bringing the pen into the 21st century! sdc bixby capsule showcase finale in addition to all these big developments, the bixby challenge came to a close. the five finalists took the stage to show off the capsules they developed using the bixby platform. it wasn’t an easy choice for the judges, and after much deliberation they came to a decision. congratulations to the winner! best of show: roger kibbe for his one bin app thanks to all the developers, designers, creators, partners, sponsors and everyone else who joined us at #sdc18. it truly was a great event and we’re excited to see how you bring all our announcements to life. follow us on @samsung_dev to keep the conversation going and keep an eye on our blog for technical content that will bring your dev game to the next level. see you next year!

      Samsung Developer Program

      https://developer.samsung.com/sdp/blog/en-us/2018/11/09/the-dev-discourse-a-daily-roundup-from-sdc18-day-2
      1. tutorials | game, mobile

      blog

      Foldable Device Features with Unity and Unreal Engine 4

      intro foldable technology for mobile is a ground-breaking experience not only for users, but also for developers. the presence of many form factors, like immersive display, app continuity, flex mode, and ux optimization, challenge developers to think outside of the box to adapt to this technology. there are already a large number of blogs talking about general application considerations, but what about gaming on a foldable device? in this blog, we look at the challenges and new opportunities foldable devices present for mobile game development. this blog focuses on unity and unreal engine as they are the most common game engines for mobile development. however, a lot of the information applies to other engines as well. app continuity and multi-window mode firstly, let's establish that the large internal display is called the main display whilst the smaller external display is called the cover display. app continuity and multi-window mode are two key features of foldable smartphones. with app continuity, you can seamlessly transition between the cover display to the main display without needing to reopen the app. with multi-window, you can run multiple apps at once and multitask like never before. app continuity moving an app between the two displays affects the size, density, and aspect ratio of the display it can use. app continuity is enabled and disabled from the android manifest of the app: the <activity> element has a new attribute called resizeableactivity. if not set, this attribute defaults to true, thus enabling app continuity and assuming the app fully supports both app continuity and multi-window mode. if set to true then the application automatically attempts to resize when moving between displays, as shown in the video below. if set to false then the system still allows you to transition from the cover display to the main display but does not attempt to resize the application. instead, a new button appears, allowing the user to restart the application at a time of their choosing, as shown below. when the app transitions between the two displays, the activity is destroyed and recreated. as such, the app data needs to be stored and then used to restore the previous state. from testing, both unity and unreal engine appear to handle this process already. however, if you are developing on a custom engine, it is worth confirming that your engine/app can handle this. continue on cover screen by default, foldable devices simply lock the device when closing the main display. however, it is possible for users to disable this functionality for certain apps. in the device's display settings, there is an option called "continue on cover screen" that has to be enabled by the user. entering this menu displays a list of all applications on the device and enables users to set specific applications to not lock the device when closing the main display. if an application has resizeableactivity set to false then the option to enable this functionality is greyed out and is not available. if your application supports resizing and app continuity then you should make sure to test that this works as users may wish to enable this functionality on their device. multi-window mode multi-window mode can allow up to three apps to run at the same time in a split-screen arrangement (see left image) or for two apps to run in pop-up mode which keeps one app full-screen but creates another app in a smaller pop-up window (see right image). just like app continuity, this is enabled using the attribute resizeableactivity in the android manifest. if resizeableactivity is not set then it defaults to true. so again, it is recommended that you set this yourself to ensure that your app works as intended. app continuity without multi-window mode if you would like your app to support app continuity but don't want it to be used by the multi-window mode, then this is possible. first, you should set the resizableactivity attribute to false to disable both app continuity and multi-window mode. next use the following <meta-data> element in your <activity> element: <meta-data android:name="android.supports_size_changes" android:value="true" /> this re-enables the app continuity feature without enabling multi-window mode. game engine features to use if using existing game engines then there are several existing features that are useful if developing for foldable devices. this section provides a high-level look at these features. for more in-depth information, i recommend visiting the engine's documentation. unity unity is a very good engine for developing on foldable devices, requiring little to no setup to enable features for foldable devices. the engine automatically handles resizing of the application without any modifications required. the resizeableactivity attribute is controlled by an option in the player settings: resizable window. when enabled, resizeableactivity appears to be set to true; when disabled, resizeableactivity appears to be set to false. note this option is not available in older versions of unity. if this option is not present then you have to set the resizeableactivity manually. the engine also provides a very robust ui scaling system that helps to reduce the amount of work required to create a ui that works across both the cover display and main display. the canvas scaler and anchor system work very well with foldable devices and work to resize and position elements consistently across the two displays, thus preventing developers from having to create two ui designs (one for cover display and one for main display). unreal engine 4 unreal engine 4 is another good engine for developing on foldable devices, although it requires a little more work to get it set up for foldable devices. first of all, unreal engine 4 by default disables the resize event on android devices, however, it is possible to re-enable it in device profiles using the console variable: r.enablenativeresizeevent = 1 unreal engine 4 by default also has a max aspect ratio of 2.1. this is, however, too small for the cover display of some foldable devices which can result in black bars on either side of the image. fortunately, unreal engine makes this value easily changeable in the project settings: platform -> android -> max aspect ratio from my testing, 2.8 is a good value. however, i recommend users experiment to find the best value. unreal engine's umg (unreal motion graphics ui designer) has a comprehensive set of tools for creating responsive ui designs. this system automatically scales ui elements to fit the screen size, and the anchor system is also very useful for ensuring the ui elements are positioned correctly between the two displays. samsung remote test lab no matter what engine you use, the best way to ensure your app works well on a foldable device is to test it on a foldable device. samsung remote test lab has a range of foldable devices available for developers to test their applications on if getting hold of a physical device is too difficult or expensive. all you need to do is create a samsung account and you can start using these devices for testing. android jetpack windowmanager despite being very good engines for foldable game development, neither unity nor unreal currently provide information about the current state of the foldable device (that is, is it open/closed/halfway?, where is the fold positioned?, what is the fold's orientation? and so forth). however, android has recently created a new library as a part of their android jetpack libraries that enables developers to access this information and make use of it in their apps. android jetpack in their own words is "a suite of libraries to help developers follow best practices, reduce boilerplate code, and write code that works consistently across android versions and devices so that developers can focus on the code they care about." windowmanager is a new library from the android jetpack suite, intended to help application developers support new device form factors and multi-window environments. the library had its 1.0.0 release in january 2022, and targeted foldable devices but—according to the documentation—future versions will extend to more display types and window features. more technical resources this blogpost has an accompanying technical blogpost and code lab tutorial, demonstrating how to use the android jetpack windowmanager with both unity and unreal to take advantage of the flex mode feature of samsung's foldable devices. i recommend starting with the jetpack windowmanager blogpost to learn how to set up the windowmanager in java: https://developer.samsung.com/galaxy-gamedev/blog/en-us/2022/07/20/how-to-use-jetpack-window-manager-in-android-game-dev then, follow it up with the code labs to learn how to make use of the windowmanager to implement a simple flex mode setup in either unreal or unity: https://developer.samsung.com/codelab/gamedev/flex-mode-unreal.html https://developer.samsung.com/codelab/gamedev/flex-mode-unity.html also, visit our game developer community to join the discussion around mobile gaming and foldable devices. click here to find out more about other design considerations when designing apps for foldable devices and large screens. final thoughts foldable devices provide a richer experience than regular phones. hopefully, this blogpost and accompanying tutorial have provided you with the necessary information to begin taking advantage of these new form factors and start providing users a richer foldable experience. additional resources on the samsung developers site the samsung developers site has many resources for developers looking to build for and integrate with samsung devices and services. stay in touch with the latest news by creating a free account and subscribing to our monthly newsletter. visit the galaxy store games page for information on bringing your game to galaxy store and visit the marketing resources page for information on promoting and distributing your android apps. finally, our developer forum is an excellent way to stay up-to-date on all things related to the galaxy ecosystem.

      Lochlann Henry Ramsay-Edwards

      https://developer.samsung.com/galaxy-gamedev/blog/en-us/2022/09/16/foldable-device-features-with-unity-and-unreal-engine-4
      1. Learn
      2. Code Lab

      codelab

      Optimize game performance with Adaptive Performance in Unity

      optimize game performance with adaptive performance in unity objective learn how to optimize the performance of a demo game on samsung galaxy devices using the adaptive performance in unity. the adaptive performance package provides you with tools to properly adjust you’re game and improve its overall game performance. overview galaxy gamesdk delivers an interface between game application and device which helps developers optimize their games. integrating unity adaptive performance with galaxy gamesdk allows unity developers to use this feature on unity editor within unity package manager and also customize their game contents by c# scripting. game performance and quality settings can be adjusted in real time by identifying device performance status and heat trends. moreover, using a set of simple ui controls, you can scale the quality of the game to match the device platform. the latest version of adaptive performance, now uses new android apis that gather information from samsung hardware to provide more detailed insights into the device's thermal components and cpu optimization. there are two providers for adaptive performance. the samsung provider 5.0 utilizes apis from the gamesdk, which is supported from samsung galaxy s10 or note10 devices until newer models. on the other hand, the android provider 1.2 uses the android dynamic performance framework (adpf) apis and is supported on devices running android 12 or higher. this code lab focuses on using the samsung provider of adaptive performance. thermal throttling mobile devices lack active cooling systems, causing temperatures to rise. this triggers a warning to the unity subsystems, which lowers hardware demand to control heat and avoid performance degradation. the ideal goal is to make performance stable with low temperature. adaptive performance, primarily for performance and quality balance management, can help achieve this. thermal warning the warning system implemented in gamesdk can trigger both internal unity systems and developer-defined behavior, such as disabling custom scripts and shaders. quality settings it also provides you with the option to adjust the quality of the game to maintain stable performance at different warning levels. you can scale the quality of your game in real time to meet the desired performance. this includes changes in level of detail, animation, physics, and visual effects. scalers with adaptive performance enabled, the game's fps becomes more stable and consistently higher over time. this is because the game adapts its contents based on thermal warnings provided by samsung's thermal callback system. the adaptive performance in unity provides developers with scalers that affect various aspects of the game: frame rate resolution batching level of detail (lod) lookup texture (lut) multisample anti-aliasing (msaa) shadow cascade shadow distance shadow map resolution shadow quality sorting transparency view distance physics decals layer culling these general scalers can be used to scale the content based on your settings in the editor. however, you may also create custom scalers that integrate with your own systems. for instance, your own scalers can disable cpu-expensive scripts from running when thermal warnings are reached. the latest version of adaptive performance, v5.0, includes new additions to the scalers: decal scaler changes the draw distance of decals. it controls how far a decal can be before not being rendered. layer culling scaler adjusts the distance that expensive layers, such as transparency or water, when they start being culled. it’s a useful scaler for scenes with more expensive shader calculations. in every frame, unity calculates how all the physics in a level interacts with everything else, such as when the ball is dropping to the floor. physics scaler adjusts the frequency at which this calculation is performed. a lower frequency means fewer cpu calculations per second. set up your environment you will need the following: unity editor version 2022.3 visual studio or any source code editor supported samsung galaxy device remote test lab (if physical device is not available) requirements: samsung account java runtime environment (jre) 7 or later with java web start internet environment where port 2600 is available sample code here is a sample project for you to start coding in this code lab. download it and start your learning experience! adaptive performance sample code (903.96 mb) demo game the sample project contains a demo game named boat attack. it is an open-source demo game provided by unity. it has the following features: triangles: 800,000 vertices: 771,000 shadow casters: 133 start your project after downloading the sample project, follow the steps to open your project: launch the unity hub. click projects > open. after locating the unzipped project folder, you can open it in unity editor. it initially downloads the needed resources for your project. open benchmark_island-flythrough scene found under assets. notethe project was tested in unity 2022.3. it is recommended to use this version in this code lab. set up adaptive performance components in window > package manager > adaptive performance, you can check if the adaptive performance is already included in the project. go to edit > project settings > adaptive performance. enable the initialize adaptive performance on startup and select samsung android provider. enable the scalers by going to adaptive performance > samsung (android) > indexer settings. check the scaler settings and just use the default values. add adaptive performance script to your project you are going to use a script that contains examples of the adaptive performance api code. it gives you access to the frame time information, thermal information, and cpu/gpu bottlenecks. this script adjusts the performance based on the device's thermal state, allowing longer game time by reducing in-game demands. download the adaptive performance script: adaptiveperformanceconroller.cs (6.15 kb) simply drag and drop the script into assets folder. create a new object and attach the script to the object. change the frame rate based on thermal warnings get to know about thermal warnings throttling warnings allow you to know when your game is about to be forcibly throttled and have sections of lag and lowered frame rate. adaptive performance provides these thermal alerts that allow you to take control and adjust settings before the performance downgrades. check the registered event handler to trigger thermal status: ithermalstatus.thermalstatus.thermalevent then, check thermalmetrics information in the handler. name description value nowarning no warning is the normal warning level during standard thermal state. 0 throttlingimminent if throttling is imminent, the application should perform adjustments to avoid thermal throttling. 1 throttling if the application is in the throttling state, it should make adjustments to go back to normal temperature levels. 2 temperaturelevel (0.0 ~ 1.0) current normalized temperature level in the range of [0, 1]. a value of 0 means standard operation temperature and the device is not in a throttling state. a value of 1 means that the maximum temperature of the device is reached and the device is going into or is already in throttling state. temperaturetrend (-1.0 ~ 1.0) current normalized temperature trend in the range of [-1, 1]. a value of 1 describes a rapid increase in temperature. a value of 0 describes a constant temperature. a value of -1 describes a rapid decrease in temperature. it takes at least 10s until the temperature trend may reflect any changes. adjust the frame rate in the adaptiveperformancecontroller.cs, the following code is responsible for changing the frame rate depending on the current thermal alert: void onthermalevent(thermalmetrics ev) { switch (ev.warninglevel) { case warninglevel.nowarning: application.targetframerate = 30; break; case warninglevel.throttlingimminent: application.targetframerate = 25; break; case warninglevel.throttling: application.targetframerate = 15; break; } } change the quality settings the performance bottleneck api informs you via an enum value if there is a bottleneck so you can adjust the workload: iadaptiveperformance.performancestatus.performancemetrics.performancebottleneck namespace unityengine.adaptiveperformance { public enum performancebottleneck { unknown = 0, cpu = 1, gpu = 2, targetframerate = 3 } } in the adaptiveperformancecontroller.cs script, the code below is responsible for controlling the lod of the models depending on the performance bottleneck. a model with multiple lod is a prime example of a quality setting that can heavily affect the games performance. lowering it lessens the load on the gpu, frees up resources, and eventually prevents thermal throttling. change the quality setting by adjusting lod in real time by using the performancebottleneck api. switch (ap.performancestatus.performancemetrics.performancebottleneck) // iadaptiveperformance.performancestatus.performancemetrics.performancebottleneck { case performancebottleneck.gpu: debug.logformat("[adp] performancebottleneck.gpu "); lowerlod(); break; case performancebottleneck.cpu: debug.logformat("[adp] performancebottleneck.cpu "); break; case performancebottleneck.targetframerate: debug.logformat("[adp] performancebottleneck.targetframerate "); break; case performancebottleneck.unknown: debug.logformat("[adp] performancebottleneck.unknown"); break; } create a custom scaler to create custom scalers, you need to create a new class that inherits from adaptiveperformancescaler. the adaptive performance package includes this class that can be added to the adaptive performance framework, which adjusts quality settings based on unity's thermal settings. download this custom scaler to control the texture quality of the demo game: texturescaler.cs (1.17 kb) simply drag and drop the downloaded file into the project. test using device simulator in unity the device simulator in unity allows you to test out adaptive performance functionality without a physical mobile device. go to window > general > device simulator. go to edit > project settings > adaptive performance. enable the initialize adaptive performance on startup and select device simulator provider. in the device simulator, you can try to send thermal warnings and create artificial bottlenecks to test different behaviors of the demo game. the visual scripts display the scalers available and show if it is enabled. enabling a specific scaler means that the adaptive performance w you can override the scalers to test their impact on the demo game's performance and scene. some scalers may not affect the scene but may improve the performance in the long run. build and launch the apk go to file > build settings. connect your galaxy device. enable development build and select scripts only build option. make sure that the autoconnect profiler is enabled to check the profiler in unity and measure the performance. in build to device, click the patch button to install or update the apk in your device. test using unity profiler unity has also introduced a new module in its profiler that allows you to monitor the scalers changes and extract frame time information to your editor. the profiler allows you to get real-time information from the adaptive performance plugin. navigate to windows > analysis > profiler. set the play mode to your connected galaxy device. once connected, you can analyze the frame time stats and check the state of the scalers during runtime. scalers in this profiler are reacting to the thermal trend and are being raised or lowered in response to the thermal warning. observe the scalers when enabled or disabled texture scaler the texture scaler is the custom script to lower the texture quality based on thermal levels. when enabled and maxed out, the texture fidelity has been lowered. this lowers the gpu load and memory usage. lod scaler you may notice a subtle change in the appearance of the rocks, trees, and umbrella models. this is due to the adaptation of the lod bias that determines which version of the models to use. as the thermal levels rise, lower poly models are selected to reduce the number of triangles rendered. this reduces the gpu load and minimizes thermal build-up. shadow map resolution shadow map resolution creates a blurring effect on the shadows which incidentally lowers the performance load required to render them. basically, lower shadow detail means fewer gpu calculations, which lead to less heat build-up. check the game performance using gpuwatch gpuwatch is a profiling tool for observing gpu activity in your app. the following are the common information shown by the gpuwatch: fps counters current average cpu and gpu load cpu load gpu load it is very helpful in profiling your game during the post-development stage so you can further optimize. to enable gpuwatch on your galaxy device: you can easily reposition the gpuwatch widgets on the screen by enabling unlock widgets under the notification menu of gpuwatch. you’re done! congratulations! you have successfully achieved the goal of this code lab. now, you can improve and optimize your android game on samsung galaxy devices using adaptive performance in unity by learning about scalers, thermal warnings, and bottleneck apis. the performance of your mobile games can be pushed further by utilizing these tools. to learn more, visit: developer.samsung.com/galaxy-gamedev

      https://developer.samsung.com/codelab/gamedev/adaptive-performance-unity.html
      1. Learn
      2. Code Lab

      codelab

      Implement Flex Mode into a Unity game

      implement flex mode into a unity game objective learn how to implement flex mode into a unity game using android jetpack windowmanager and unity's java native interface (jni) wrapper. overview the flexible hinge and glass display on galaxy foldable devices, such as the galaxy z fold4 and galaxy z flip4, let the phone remains propped open while you use apps. when the phone is partially folded, it will go into flex mode. apps will reorient to fit the screen, letting you watch videos or play games without holding the phone. for example, you can set the device on a flat surface, like on a table, and use the bottom half of the screen to navigate. unfold the phone to use the apps in full screen mode, and partially fold it again to return to flex mode. to provide users with a convenient and versatile foldable experience, developers need to optimize their apps to meet the flex mode standard. set up your environment you will need the following: unity hub with unity 2022.3.5f1 or later (must have android build support) visual studio or any source code editor galaxy z fold2 or newer remote test lab (if physical device is not available) requirements: samsung account java runtime environment (jre) 7 or later with java web start internet environment where port 2600 is available sample code here is a sample project for you to start coding in this code lab. download it and start your learning experience! flex mode on unity sample code (1.17 gb) start your project after downloading the sample project files, follow the steps below to open your project: launch the unity hub. click projects > open. locate the unzipped project folder and click open to add the project to the hub and open in the editor. notethe sample project was created in unity 2022.3.5f1. if you prefer using a different unity version, click choose another editor version when prompted and select a higher version of unity. configure android player settings to ensure that the project runs smoothly on the android platform, configure the player settings as follows: go to file > build settings. under platform, choose android and click switch platform. wait until this action finishes importing necessary assets and compiling scripts. then, click player settings to open the project settings window. go to player > other settings and scroll down to see target api level. set it to api level 33 as any less than this will result in a dependency error regarding an lstar variable. you can set the minimum api level on lower levels without any problem. next, in the resolution and presentation settings, enable resizable window. it is also recommended that render outside safe area is enabled to prevent black bars on the edges of the screen. lastly, enable the custom main manifest, custom main gradle template, and custom gradle properties template in the publishing settings. after closing the project settings window, check for the new folder structure created within your assets in the project window. the newly created android folder contains androidmanifest.xml, gradletemplate.properties, and maintemplate.gradle files. import the foldablehelper and add dependencies foldablehelper is a java file that you can use in different projects. it provides an interface to the android jetpack windowmanager library, enabling application developers to support new device form factors and multi-window environments. before proceeding, read how to use jetpack windowmanager in android game dev and learn the details of how foldablehelper uses windowmanager library to retrieve information about the folded state of the device (flat for normal mode and half-opened for flex mode), window size, and orientation of the fold on the screen. download the foldablehelper.java file here: foldablehelper.java (6.22 kb) to import the foldablehelper.java file and add dependencies to the project, follow the steps below: in assets > plugins > android, right-click and select import new asset. locate and choose the foldablehelper.java file, then click import. next, open the gradletemplate.properties file to any source code editor like visual studio and add the following lines below the **additional_properties** marker. android.useandroidx = true android.enablejetifier = true useandroidx sets the project to use the appropriate androidx libraries instead of support libraries. enablejetifier automatically migrates existing third-party libraries to use androidx by rewriting their binaries. lastly, open the maintemplate.gradle file and add the dependencies for the artifacts needed for the project. **apply_plugins** dependencies { implementation filetree(dir: 'libs', include: ['*.jar']) implementation "androidx.appcompat:appcompat:1.6.1" implementation "androidx.core:core:1.10.1" implementation "androidx.core:core-ktx:1.10.1" implementation "androidx.window:window:1.0.0" implementation "androidx.window:window-java:1.0.0" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.0" **deps**} create a new playeractivity to implement flex mode on your applications, you must make necessary changes to the activity. since it is impossible to access and change the original unityplayeractivity, you need to create a new playeractivity that inherits from the original. to do this: create a new file named foldableplayeractivity.java and import it into the android folder, same as when you imported the foldablehelper.java file. to extend the built-in playeractivity from unity, write below code in the foldableplayeractivity.java file. package com.unity3d.player; import android.os.bundle; import com.unity3d.player.unityplayeractivity; import com.samsung.android.gamedev.foldable.foldablehelper; import com.samsung.android.gamedev.foldable.foldablehelper.windowinfolayoutlistener; import android.util.log; public class foldableplayeractivity extends unityplayeractivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); foldablehelper.init(this); } @override protected void onstart() { super.onstart(); foldablehelper.start(this); } @override protected void onstop() { super.onstop(); foldablehelper.stop(); } @override protected void onrestart() { super.onrestart(); foldablehelper.init(this); } public void attachunitylistener(windowinfolayoutlistener listener){ foldablehelper.attachnativelistener(listener, this); } } oncreate() calls the foldablehelper.init() to ensure that the windowinfotracker and metrics calculator gets created as soon as possible. onstart() calls the foldablehelper.start() since the first windowlayoutinfo doesn't get created until onstart(). onstop() calls the foldablehelper.stop() to ensure that when the application closes, the listener gets cleaned up. onrestart() calls foldablehelper.init() when returning to the app after switching away. windowinfotracker must be re-initialized; otherwise, flex mode will no longer update. after creating the foldableplayeractivity, ensure that the game uses it. open the androidmanifest.xml file and change the activity name to the one you've just created. <activity android:name="com.unity3d.player.foldableplayeractivity" android:theme="@style/unitythemeselector"> … </activity> store foldablelayoutinfo data to flexproxy implement a native listener that receives calls from java when the device state changes by following these steps: use the androidjavaproxy provided by unity in its jni implementation. androidjavaproxy is a class that implements a java interface, so the next thing you need to do is create an interface in the foldablehelper.java file. public interface windowinfolayoutlistener { void onchanged(foldablelayoutinfo layoutinfo); } this interface replaces the temporary native function. therefore, remove the code below from the foldablehelper.java file: public static native void onlayoutchanged(foldablelayoutinfo resultinfo); then, go to the assets > flex_scripts folder and right-click to create a new c# script called flexproxy.cs. inside this script, replace the automatically generated class with the flexproxy class inheriting from androidjavaproxy: public class flexproxy : androidjavaproxy { } in flexproxy class, define the variables needed to store the data from foldablelayoutinfo and use enumerators for the folded state, hinge orientation, and occlusion type. for the various bounds, use unity's rectint type. also, use a boolean to store whether the data has been updated or not. public enum state { undefined, flat, half_opened }; public enum orientation { undefined, horizontal, vertical }; public enum occlusiontype { undefined, none, full }; public state state = state.undefined; public orientation orientation = orientation.undefined; public occlusiontype occlusiontype = occlusiontype.undefined; public rectint foldbounds; public rectint currentmetrics; public rectint maxmetrics; public bool needsupdate = false; next, define what java class the flexproxy is going to implement by using the interface's fully qualified name as below: public flexproxy() : base("com.samsung.android.gamedev.foldable.foldablehelper$windowinfolayoutlistener") { } com.samsung.android.gamedev.foldable is the package name of the foldablehelper.java file. foldablehelper$windowinfolayoutlistener is the class and interface name separated by a $. after linking the proxy to the java interface, create a helper method to simplify java to native conversions. private rectint converttorectint(androidjavaobject rect) { if(rect != null) { var left = rect.get<int>("left"); var top = rect.get<int>("top"); var width = rect.call<int>("width"); var height = rect.call<int>("height"); return new rectint(xmin: left, ymin: top, width: width, height: height); } else { return new rectint(-1, -1, -1, -1); } } this method takes a java rect object and converts it into a unity c# rectint. now, use this converttorectint() function for the onchanged() function to retrieve the information from the java object and store it in the flex proxy class: public void onchanged(androidjavaobject layoutinfo) { foldbounds = converttorectint(layoutinfo.get<androidjavaobject>("bounds")); currentmetrics = converttorectint(layoutinfo.get<androidjavaobject>("currentmetrics")); maxmetrics = converttorectint(layoutinfo.get<androidjavaobject>("maxmetrics")); orientation = (orientation)(layoutinfo.get<int>("hingeorientation") + 1); state = (state)(layoutinfo.get<int>("state") + 1); occlusiontype = (occlusiontype)(layoutinfo.get<int>("occlusiontype") + 1); needsupdate = true; } implement native flex mode this section focuses on creating the flex mode split-screen effect on the game’s ui. create a new c# script in the flex_scripts folder called flexmodemanager.cs. after creating the script, define the variables you need for this implementation. public class flexmodemanager : monobehaviour { private flexproxy windowmanagerlistener; [serializefield] private camera maincamera; [serializefield] private camera skyboxcamera; [serializefield] private canvas controlscanvas; [serializefield] private canvas healthcanvas; [serializefield] private gameobject flexbg; [serializefield] private gameobject uiblur; windowmanagerlistener is the callback object which receives the foldablelayoutinfo from the foldablehelper.java implementation maincamera and skyboxcamera are two cameras to modify in this project for creating a seamless flex mode implementation controlscanvas and healthcanvas are the two ui elements to manipulate for implementing the flex mode flexbg is a background image to disable in normal mode and enable in flex mode to fill the bottom screen uiblur is a background blur element used as part of the tutorial text. it doesn't function properly with flex mode, so disabling it when in flex mode makes the ui looks better. next, in the start() method, create a new instance of the flexproxy class and attach it to the unity application's activity via the attachunitylistener function. void start() { windowmanagerlistener = new flexproxy(); using (androidjavaclass javaclass = new androidjavaclass("com.unity3d.player.unityplayer")) { using (androidjavaobject activity = javaclass.getstatic<androidjavaobject>("currentactivity")) { activity.call("attachunitylistener", windowmanagerlistener); } } } in the update() method, check if the windowmanagerlistener has received any new data on the folded state of the device. if the system needs an update, then call updateflexmode(). void update() { if (windowmanagerlistener.needsupdate) { updateflexmode(); } } create the updateflexmode() method to enable or disable flex mode. notethis project is set up for landscape mode only. the implementation discussed in this code lab only covers setting up flex mode with a horizontal fold in landscape. however, if you were able to follow, it should be simple to set up something similar for different fold orientations on devices such as the galaxy z flip series of devices. private void updateflexmode() { } check the folded state of the device via the windowmanagerlistener. if the device is half_opened, implement flex mode. private void updateflexmode() { if (windowmanagerlistener.state == flexproxy.state.half_opened) { } } to split the ui screen horizontally, set the anchor points of the controlscanvas and the healthcanvas so they are locked at the bottom screen or below the fold. also, set the viewports of the maincamera and skyboxcamera to be above the fold - which is the top screen. next, set the anchors for the flexbg object and enable it to fill the space behind the ui on the bottom screen. deactivate the uiblur element if it exists. the ui blur element is only present at level 1 of the demo game. a check is necessary to ensure the flex mode manager works on the second level. private void updateflexmode() { if (windowmanagerlistener.state == flexproxy.state.half_opened) { float lowerscreenanchormax = (float)windowmanagerlistener.foldbounds.ymin / windowmanagerlistener.currentmetrics.height; recttransform controlscanvastransform = controlscanvas.getcomponent<recttransform>(); recttransform healthcanvastransform = healthcanvas.getcomponent<recttransform>(); recttransform flexbgtransform = flexbg.getcomponent<recttransform>(); controlscanvastransform.anchormin = new vector2(0, 0); controlscanvastransform.anchormax = new vector2(1, lowerscreenanchormax); healthcanvastransform.anchormin = new vector2(0, lowerscreenanchormax); healthcanvastransform.anchormax = new vector2(0, lowerscreenanchormax); flexbgtransform.anchormin = new vector2(0, 0); flexbgtransform.anchormax = new vector2(1, lowerscreenanchormax); float upperscreenrectheight = (float)windowmanagerlistener.foldbounds.ymax / windowmanagerlistener.currentmetrics.height; maincamera.rect = new rect(0, upperscreenrectheight, 1, upperscreenrectheight); skyboxcamera.rect = new rect(0, upperscreenrectheight, 1, upperscreenrectheight); flexbg.setactive(true); if(uiblur != null) uiblur.setactive(false); } } return the ui to full screen when the device is no longer in flex mode by: disabling flexbg; enabling uiblur when it exists; and setting all the anchor points and viewports back to their original values. and finally, inform the windowmanagerlistener that it doesn't need an update. else { recttransform controlscanvastransform = controlscanvas.getcomponent<recttransform>(); recttransform healthcanvastransform = healthcanvas.getcomponent<recttransform>(); controlscanvastransform.anchormin = new vector2(0, 0); controlscanvastransform.anchormax = new vector2(1, 1); healthcanvastransform.anchormin = new vector2(0, 1); healthcanvastransform.anchormax = new vector2(0, 1); maincamera.rect = new rect(0, 0, 1, 1); skyboxcamera.rect = new rect(0, 0, 1, 1); flexbg.setactive(false); if (uiblur != null) uiblur.setactive(true); } windowmanagerlistener.needsupdate = false; set up the scenes for flex mode go back to the unity editor. in assets > 3dgamekit > scenes > gameplay, double-click on the level 1 scene to open it. right-click in the hierarchy window and select create empty. name the new gameobject as flexmanager or a similar name to reflect its purpose. select the flexmanager object and click the add component button in the inspector window. type in flexmodemanager, and select the script when it shows up. select the relevant objects for each camera, canvas and game object as below: do the same for level 2 but leave the ui blur empty. build and run the app go to file > build settings. click build at the bottom of the window to build the apk. after building the apk, run the game app on a foldable galaxy device and see how the ui switches from normal to flex mode. if you don’t have any physical device, you can also test it on a remote test lab device. tipwatch this tutorial video and know how to easily test your app via remote test lab. you're done! congratulations! you have successfully achieved the goal of this code lab. now, you can implement flex mode in your unity game app by yourself! to learn more, visit: www.developer.samsung.com/galaxy-z www.developer.samsung.com/galaxy-gamedev

      https://developer.samsung.com/codelab/gamedev/flex-mode-unity.html
      No Search Results
      No Search results. Try using another keyword.
      • <<
      • <
      • 1
      • 2
      • 3
      • 4
      • 5
      • 6
      • >
      • >>
      Samsung Developers
      Samsung Developers
      Quick Link
      • Android USB Driver
      • Code Lab
      • Galaxy Emulator Skin
      • Foldables and Large Screens
      • One UI Beta
      • Remote Test Lab
      • Developer Support
      Family Site
      • Bixby
      • Knox
      • Samsung Pay
      • SmartThings
      • Tizen
      • Samsung Research
      • SamsungOpen Source
      • Samsung Dev Spain
      • Samsung Dev Brazil
      Legal
      • Terms
      • Privacy
      • Open Source License
      • Cookie Policy
      Social Communications
      • Facebook
      • Instagram
      • Twitter
      • YouTube
      • Buzzsprout
      • Rss
      • Linkedin
      • System Status
      • Site Map
      • System Status
      • Site Map
      • facebook
      • instagram
      • twitter
      • youtube
      • buzzsprout
      • rss
      • linkedin

      Copyright © 2023 SAMSUNG. All rights reserved.