UNITY
Last updated
Last updated
Download the Latest Version
Set the development environment as shown in the following in Unity in order to use NaverGame SDK.
This guideline has been written with respect to version Unity2019.4.20f
Click Asset > Import package from Unity’s menu, then select the NaverGameSDK-x.x.x.unityPackage file downloaded from the Custom Package conversation box.
Once you click Import from the Custom Package conversation box the NGSDK folder and the Plugins folder will be generated.
A standard run button is included inside the SampleScene file contained in the NGSDK Folder’s Sample folder. If the Unity versions are different, SampleScene might not load properly. In this case, refer to the following guideline to configure a new UI.
Click on GameObject > UI > Canvas to generate UGUI Canvas.
Drag SampleButton.Prefab within the Sample folder in the NGSDK under the generated Canvas. A standard button provided by NaverGameSDK is generated.
For convenience, the NaverGame SDK run button can be generated using the standard button provided by NaverGame SDK. The sample code is written in the SampleBehaviour.cs file.
NaverGame SDK’s run button is written based on Unity’s UGUI. In the case that UGUI is not used or that a different library is used, it may be used while referring to the SampleBehaviour.cs file.
Detailed information regarding the NaveGame SDK with respect to different operating systems will be referenced on GitHub Storages.
For NAVER Game SDK to support Android 12 (API level 31) or more, versions such as Unity 2020 or higher must be installed. Also, to support Android 11 (API level 30), additional settings are required in the Unity 2019 version.
minSdkVersion must be set to 21 or over.
mindSdkVersion has been set to 19 for library compatibility, but because of targetSdk30 Issue (https://github.com/square/okhttp/issues/5162) of OKHttp 3.14.7, version 21 or above needs to be used.
Additional settings are required to support versions below 21, and these can only be supported in the Gradle build.
Please refer to the relevant link in the Android guide for information on settings for versions below 21.
2-1. Unity 2019.4.20f
Since the 1.2.0 version of the Android Library, public package status element has been added to support Android 11 (API level 30). In order to compile the public package status <queryies> element, Gradle version 5.6.4 or higher is required.
Android Gradle Plugin version for Gradle version 5.6.4 is version 3.6.0. To view the compatibility of Android Gradle plugin and Gradle version that you are currently using, please refer to the Android Gradle plugin compatibility table.
Please see the following for Gradle and Android Gradle Plugin settings.
2-1-1. Gradle Version 5.6.4 Settings
Go to Preferences > External Tools > Android > Gradle Installed with Unity. Delete the option and select custom version of 5.6.4 or above. For information on custom version downloads, please refer to the Gradle build tool.
2-1-2. Android Gradle Plugin Settings
Go to Project Settings > Player > Android Tab > Publishing Settings > Build, and select Custom Main Gradle Template, Custom Base Gradle Template, and Custom Gradle Properties Template.
Once the options are selected, the baseProjectTemplate.gradle file should have been generated in Assets/Plugins/Android folder. Open this file using the editor, delete the com.android.tools.build.gradle:3.4.0 item under dependencies, and edit this to 3.6.0 or higher, as shown below.
Once you’ve gotten this far, Gradle setup is complete. The mainTemplate.gradle and gradleTemplate.properties files also need to be set in Unity 2020 or higher versions, and these will be explained in the next section.
2-2. Unity 2020 or Higher
To support Android 12+(API level 31) or higher, Navergame SDK versions after 1.2.0 only support Gradle universal library. In order to use Gradle universal library, you need to add the dependency through the Custom Gradle settings.
Go to Project Settings > Player > Android Tab > Publishing Settings > Build and select Custom Main Gradle Template and Custom Gradle Properties Template.
Once the options are selected, mainTemplate.gradle file should have been generated in Assets/Plugins/Android folder. Open this file using the editor, and add a subordinate library under dependencies.
From versions 1.2.0 onwards, naveridlogin-android-sdk has been added for writing purposes, and kotlin-stdlib, retrofit, converter-gson versions have been changed. Please keep this in mind when upgrading from the 1.x.x version.
Also, open gradleTemplate.properties item and add the android.useAndroidX, android.enableJetifier items as true.
2-3. Minify Settings
Complete the Minify(proguard) setup for the Release build.
Go to Build Settings > Player Settings > AndroidTab > Publishing Settings and select Custom Proguard File setting to create a new proguard-user.txt file.
Activate Release at Build Settings > Player Settings > AndroidTab > Publishing Settings > Minify.
Open proguard-user.txt file and add the following proguard settings.
Naver Game iOS SDK supports iOS versions 12.0 and above.
Additional items such as the following have to be set when developing an iOS game.
When building applications for iOS for versions above Unity 5.4.0f3, the. bundle file is set to not become linked. iOS must be selected from Select for platforms for plugin as shown in the following so that it may link the NNGSDK.bundle
Set the development environment as shown in the following in Xcode.
Select framework from the TARGETS category.
Select the Build Setting tab and find Other Linker Flags from the Linking category.
If in either of Basic or Customized modes, the Other Linker Flag might not appear, and in this case select All mode .
It can be easily found by entering Other Linker Flags into the search bar located in the upper right corner.
Add the -ObjC option and the -lc++ option to Other Linker Flags.
Add the following option to obtain user permission to Info.plist.
Privacy - Camera Usage Description
Privacy - Photo Library Usage Description
Select the app that is going to be run amongst the TARGETS category, and input the Identifier values and URL Schemes values into the URL Types category of the Info tab.
The Identifier value can be checked from the General tab of the relevant TARGET.
For the URL Schemes value , input the URL Scheme value that was used to register for the application in the developers center after logging in with a Naver Id.
Add SafariServices.framework and NaverLogin.framework at Build Phases -> Link Binary With Libraries.
The init method has to be called for before using the NaverGameSDK.
The init() method is the method that sets the NaverGameSDK. The factors needed are as follows.
loungeId: The Lounge Id received after requesting for the official lounge.
clientId: The Client Id received after registering the application at the developers center after logging in with a Naver Id.
clientSecret: The client secret received after registering the application at developers center upon logging in with a Naver Id.
The following example is a demonstration of the implementation of the init() method.
The TerminateSdk() method is the method that terminates the NaverGameSDK. It is called in when the sdk has to be terminated under certain circumstances. For example, when running an in-game menu code that is delivered through GLinkDelegate callback, the TerminateSdk() method must be called to terminate the sdk.
The following example is a demonstration of the implementation of the terminateSdk() method.
The method that displays a registered banner window.
The following example is a demonstration of the implementation of the executeHomeBanner() method.
Posts a specific notification or a notification for maintenance. From this page, transitions to other pages is limited.
The following example is a demonstration of the implementation of the executeSorryBanner() method.
This method immediately runs a certain board. BoardId can be found in the URL shown when accessing the board through the web, in the form of https://game.naver.com/lounge/{loungeId}/board/{boardId}.
The following example is a demonstration of the implementation of the executeBoard() method.
The method that runs using the number of the registered post. In the case for scheduled notification post that have scheduled through scheduled exposure, the number of the scheduled post must be inputted into FeedId and the IsTempFeedId must be inputted as True. Before the scheduled post is posted, running the method does not lead to the exposure of the post.
FeedId: The number of the notification post or the scheduled notification post.
IsTempFeedId: Remains false if the FeedId is a notification post and remains true if the FeedId is a scheduled notification post.
The following example is a demonstration of the implementation of the executeFeed() method.
This method runs the writer page. BoardId is the board number, Title is the title of the writing, Text is the content of the writing, and ImageFilePath is the path of the attached image. Only one image may be attached.
Not all parameters are necessary. If entered, they will be set in the writer page in advance.
boardId: This is the board number. This can be found in the URL shown while accessing the board through the web, in the form of https://game.naver.com/lounge/{loungeId}/board/{boardId}.
title: This is the title of the writing.
text: This is the text to be added to the main body.
imageFilePath: This is the LocalPath of the image to be attached. In Android, there is a process of obtaining image rights, so if this value is manually entered, it needs to be checked thoroughly.
The following example is a demonstration of the implementation of the writeFeed() method.
This method shows a button for writing by detecting when a user has taken a screenshot. When not summoned, the base value is ON (true).
If enabled: true, writing button appears when a screenshot is captured.
The following example is a demonstration of the implementation of the enableScreenShotDetector() method.
This method syncs with NAVER Login and matches the user and their NAVER ID. This can be used to confirm the game ID of users that win event draws through posts and comments.
This called be called at any point after the init function is called.
gameId: Input an identifiable game ID. Only one game ID is saved for one NAVER ID.
The following example is a demonstration of the implementation of the setGameId() method.
Obtain the countryCode of the device.
The countryCode is the country code (ISO 3166-1 alpha-2) composed of two alphabets. This enables branch processing by countries within the codes. The notable country codes are as shown in the following. Refer to the link for other country codes.
Country Code
Country
CN
China
JP
Japan
KR
Republic of Korea
TH
Thailand
US
United States of America
The following is an example of using the getCountryCode() method to reset the SDK exclusively for Korea.
When a specific event occurs within the SDK, using said event, the GameEngine is notified.
Occurs when NaverGameSdk is running.
The registration method is as follows.
Occurs when NaverGameSdk has been terminated.
The registration method is as follows.
Occurs when the in-game menu code has to be run in NaverGameSdk. Used when an 'In-Game Menu’ has been registered on the banners of Official Lounge Maintenance Page> SDK Maintenance> Banner Maintenance pages. Depending on the Android and iOS platforms, the registered values are delivered independently, so if different values have been inputted, they must be processed independently.
The registration method is as follows.
The SDK is usable once proper building according to the respective platform is complete.
Naver Game SDK supports both horizontal and vertical modes.
Under both Android and iOS environments, the horizontal mode and the vertical mode is applied automatically according to the screen’s horizontal and vertical orientation without the need of additional settings.