Tutorial  Updated

How to create Nintendo Switch games with Unity.

Note: NSPs build with a leaked SDK are not allowed to be shared on GBATemp (and most likely nowhere else too) because they were build with "stolen code". These NSPs can only be installed on hacked switches with sigpatches, so please only do projects for yourself instead of publishing them and making Nintendo mad & possibly even sue you.




Foreword:
If you are some random kid that wants to make a game for the switch without knowledge about Unity, Switch development and C/C++, stop right here. This is not meant for you and if you want to make a game that runs on the switch, use Godot. It is easy to make games with and they are legal to share. Dont expect any kind of help for making "illegal games", especially not if you cant read error messages to figure things out on your own.



Prerequisites
  • A leaked (or official) Nintendo Switch SDK from Nintendo (for example NX SDK 15.3.0) *
  • The corresponding Unity version (for example 2023.1.0b2)
  • The corresponding Unity "support for editor" addon. **
  • https://github.com/The-4n/hacPack on your harddrive and added to your PATH environment variable

* I will not provide links to any SDK, nor will i tell you where to find it. Don't even ask.
** These links, while not publicly shared, are not protected in any way by unity. If you have the link from their website, you can download them without any restriction. However i still wont provide any URLs.

The leaked SDKs that you can find online usually do not have the same folder structure. They are often incomplete, scrambled or in other ways messed up which makes it hard to write a unified guide for them. I will therefore base this guide on a 15.3.0 SDK that recently leaked. Your experience might be different and its a lot of trial and error to get it working.


Folder structure of the recently leaked SDK:
1675693698611.png




"Installing" the SDK

The complete SDK consists of many "addons" and most (if not all) of them are needed to make the build process work. You basically want to go through all folders and check if they have either a "NintendoSDK", "NintendoSDK-NEX", "NintendoSDK-NPLN" or "NintendoSDK-Pia6" subfolder and then merge them on your harddrive. Usually you will not overwrite any files except for maybe a license file. If you do this, you basically have a complete SDK with all addons installed to it. This is how it should look like on your harddrive once you are done (- the combined size is about 24GB.):
1675694161728.png



After you have extracted the necessary data, its time to add some environment variables. The folder path changes depending on where you put the SDK files obviously.
Restart your PC for them to take effect.
1675694314291.png





Installing Unity + Addon

Now you can install Unity and its "support for editor" addon. Make sure to install the correct version of both Unity and the addon, since the SDK is made for these specifically. You might get away with some versions lower and higher but there is absolutly no guarantee. Its best if you don't mix and match but choose the correct one. Usually the addon is delivered with the leaked SDK itself, which also tells you what Unity version to use.





Creating a game (or whatever)

It is highly advised that you read the documentation that comes with the SDK!

Stuff like character controller / HID and what not are all explained in the documentation. READ IT.

Once you are happy with your game (or whatever), click "File -> Build Settings" and change the Platform to Nintendo Switch. Let everything load, check the "Create NSP ROM File" checkbox and adjust all the NMETA settings in the "Player Settings" menu. I wont go over that stuff as its a lot and i am sure you can read and figure it out on your own. Click "Build" to create an NSP.

1675695144004.png






Making it installable

If you did everything correctly, you should now have an NSP file. But lets be honest, you do not own a dev unit to install the NSP on, do you?
Well, to be able to install and play your game on a retail switch, you need to repack it with your own retail unit keys. Use lockpick_rcm to get them and place them in (create if the folder does not exist):
Code:
C:\Users\<YOUR USER NAME>\.switch

You can then use hactool or any other method of your liking to repack the NSP. I created a simple repacker (check attachments) that does the job for me, however i wont guarantee that it works for you too. Either double-click the files or simply drag an NSP onto them. Its python code converted to an EXE so it might trigger your AV. You don't have to use it if you don't trust it but repacking research has to be done by you then.

Make sure that hacpack is on your harddrive and added to your PATH envoronment variable.
1675696284973.png


To use my repacker, the NSP needs to have its titleID somewhere inside the filename. You can check the titleID in Unity under "Player Settings -> Publishing Settings" as "Application ID" (the 0x is NOT part of the titleID). So you can rename your NSP to something like "mygame_01004b9000490000.nsp or whatever you like, then simply drag the NSP on repacker.exe.

Once you have a repacked NSP, you can install it to a retail unit running Atmosphere with sigpatches.
Have fun creating some games!





Result

The result could look like this:


2023020616251200-57B4628D2267231D57E0FC1078C0596D.jpg
PXL_20230111_050837650.jpg
 

Attachments

Last edited by Slluxx,
Slluxx, thank you for the tutorial and for your repacking tool. I managed to finally run my game on Switch after a day full of tries.
The only thing left to do is the input, and somehow I stuck there.
Trying to use nn.hid namespane with using nn.hid;
But I am getting this error: error CS0246: The type or namespace name 'nn' could not be found (are you missing a using directive or an assembly reference?)
What should I do in this case? My build running on the console just fine, so that means that SDK is installed properly. Why Unity can't use nn namespace then?
Thanks in advance

Update: Found the solution - project were lacking Plugins folder. Now I got another problem, I will update my post if I can't solve it
 
Last edited by cojam,
Slluxx, thank you for the tutorial and for your repacking tool. I managed to finally run my game on Switch after a day full of tries.
The only thing left to do is the input, and somehow I stuck there.
Trying to use nn.hid namespane with using nn.hid;
But I am getting this error: error CS0246: The type or namespace name 'nn' could not be found (are you missing a using directive or an assembly reference?)
What should I do in this case? My build running on the console just fine, so that means that SDK is installed properly. Why Unity can't use nn namespace then?
Thanks in advance

Update: Found the solution - project were lacking Plugins folder. Now I got another problem, I will update my post if I can't solve it
what is your firmware?
 
what is the variable name of hacpack?
Post automatically merged:

"Make sure that hacpack is on your harddrive and added to your PATH envoronment variable"

What would be the variable name for the hacpack"

And may I request or you may suggest a good version of hacpack to be use for repacked. Got switch to windows 11 some my old stuff is gone

Thanks
 
Last edited by gypsycoolmatch,
hello i am getting this error while building an empty unity project:
Code:
Building Library\Bee\artifacts\SwitchPlayerBuildProgram\t92hb\GameAssembly.nss failed with output:ld.lld: error: undefined symbol: nn::diag::detail::AbortImpl()>>> referenced by SwitchMemory.cpp:20 (.\PlatformDependent/Switch/Source\SwitchMemory.cpp:20)>>>               PlatformDependent_Switch_Source_0_djd3i.o:(switch_get_mem) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.a>>> referenced by Main.cpp:0 (.\PlatformDependent/Switch/Source\Main.cpp:0)>>>               PlatformDependent_Switch_Source_1_djd3i.o:(CreateSwitchAudioOutput) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.a>>> referenced by Main.cpp:770 (.\PlatformDependent/Switch/Source\Main.cpp:770)>>>               PlatformDependent_Switch_Source_1_djd3i.o:(nnMain) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.a>>> referenced 2 more timesld.lld: error: undefined symbol: nn::diag::detail::AbortImpl(nn::Result const*)>>> referenced by Main.cpp:778 (.\PlatformDependent/Switch/Source\Main.cpp:778)>>>               PlatformDependent_Switch_Source_1_djd3i.o:(nnMain) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.aclang++: error: linker command failed with exit code 1 (use -v to see invocation)UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
 
hello i am getting this error while building an empty unity project:
Code:
Building Library\Bee\artifacts\SwitchPlayerBuildProgram\t92hb\GameAssembly.nss failed with output:ld.lld: error: undefined symbol: nn::diag::detail::AbortImpl()>>> referenced by SwitchMemory.cpp:20 (.\PlatformDependent/Switch/Source\SwitchMemory.cpp:20)>>>               PlatformDependent_Switch_Source_0_djd3i.o:(switch_get_mem) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.a>>> referenced by Main.cpp:0 (.\PlatformDependent/Switch/Source\Main.cpp:0)>>>               PlatformDependent_Switch_Source_1_djd3i.o:(CreateSwitchAudioOutput) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.a>>> referenced by Main.cpp:770 (.\PlatformDependent/Switch/Source\Main.cpp:770)>>>               PlatformDependent_Switch_Source_1_djd3i.o:(nnMain) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.a>>> referenced 2 more timesld.lld: error: undefined symbol: nn::diag::detail::AbortImpl(nn::Result const*)>>> referenced by Main.cpp:778 (.\PlatformDependent/Switch/Source\Main.cpp:778)>>>               PlatformDependent_Switch_Source_1_djd3i.o:(nnMain) in archive C:/Program Files/Unity 2022.2.4f1/Editor/Data/PlaybackEngines/Switch/Native/release/SwitchPlayer.aclang++: error: linker command failed with exit code 1 (use -v to see invocation)UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

nvm ive just created a new project and now i have a nsp builded, thanks
 
I need help, I get this error but I think I have hackpack ok, what could be happening?

Captura de pantalla 2024-12-11 163123.png
Captura de pantalla 2024-12-11 163215.png
 
When I use hacpack it says success but yuzu and the switch it self say theres nothing to install. When I use repack it says
Could not find 'fs0\main'
Cleanup
Cleanup done
 
Last edited by TurtTide55,
Every time I try to save anything to the switch I get. a game crash. im trying to save the playerprefs using the example file but when it tries to save the application freezes the quits.

Anyone manage to save anything on an actual unpatched switch?
 
Every time I try to save anything to the switch I get. a game crash. im trying to save the playerprefs using the example file but when it tries to save the application freezes the quits.

Anyone manage to save anything on an actual unpatched switch?
Read the documentation of the sdk you are using. It is possible but you can not save anything to the filesystem. You need to save stuff to your games save "partition". If you are having issues doing that, something might not be initialized correctly. Catch all the returns and check them before you actually start to using the save functionality the sdk provides.
 
  • Like
Reactions: I pwned U!
I'm getting the Building Library\Bee\artificats\AppPkg\<some id>\main.npdm failed with output: The system cannot find the path specified error. I have installed the latest version of the .net 6.0 x64 SDK and already rebooted my pc twice. What else could be causing this error?
 
Trying to repack an in-development add-on, and I get:
Code:
Could not find 'fs0\main'

If you got your source python code, I can adapt the repacker for my purposes. I need to be able to repack an add-on, not a base game.
 
Last edited by StrikerMan780,
Just to remind everyone, the ones who have the original unity license key for the original Switch SDK activated in either the editor or the Unity Hub will expire on August 2026 next year cuz they are going to use a new one for the Switch/Switch 2 SDK (just like what they did with the unity license key for 3DS that got changed to 3DS/New 3DS years ago)
 

Site & Scene News

Popular threads in this forum