Tutorial How to make 3DS Games with Unity

  • Thread starter Thread starter Keksfresser
  • Start date Start date
  • Views Views 223,418
  • Replies Replies 513
  • Likes Likes 30

Should I add some Demo Projects?


  • Total voters
    54
  • Poll closed .
I retried downloading unity, but am I the only one who can't log in? When I try to Sumbit the 2fa, the button is disabled.
 
I've been quite battling against making the game working on old 3ds and it makes no sense. Giving anything above 16mb directly crashes on startup, no matter what the initial scene is. However, if I set 10mb of ram, the game runs but crashes when loading the menu. with less memory it runs but it doesn't with more, basically. Does anyone know how the 3DS handles that mem?
 
I've been quite battling against making the game working on old 3ds and it makes no sense. Giving anything above 16mb directly crashes on startup, no matter what the initial scene is. However, if I set 10mb of ram, the game runs but crashes when loading the menu. with less memory it runs but it doesn't with more, basically. Does anyone know how the 3DS handles that mem?
I know only that Unity have some memory leak bugs that heavily impact Old 3DS, but don't know anything else about it.

Not directly related but never use PlayOneShot for audio on 3DS, its bad for memory.
 
I know only that Unity have some memory leak bugs that heavily impact Old 3DS, but don't know anything else about it.

Not directly related but never use PlayOneShot for audio on 3DS, its bad for memory.
I more or less understand now why this happens, btw. The game by default has a 64mb of memory to he used in Unity. You need to define a specific chunk of memory where textures and extra data can be allocated on load when exceeding 6Mb. But this is not the “main mem”, as unity uses the other part to allocate the scenes, load code, etc. that’s why it runs when using less mem, as it has more memory to be used for loading (i set 8 mb of device ram, and extended mem so I have 72Mb to load scenes and stuff). Unity fragments the system memory a lot and it doesn’t give much space for loading.

TLDR: I got the menu to load by reducing the device memory to 8Mb in old3ds.

IMG_7959.jpeg


And my recommendation is: never use outline and shadow components for any UI element if you plan to run it on old 3DS. It works perfectly on New 3DS but kills old3DS memory.
 
This weekend I reimplemented my UDS protocol manager to allocate less memory with sliced buffers. The latency for realtime has still a bit of lag even on emulator but it works way better than my previous approach :D


Hey that's awesome! I would also like to dip my fingers more into UDS some time in the future, seems fun to make something using it

Although my first experience with it wasn't very good HAHAHAHA
Either way, nice job man! :yay3ds:
 
Hey that's awesome! I would also like to dip my fingers more into UDS some time in the future, seems fun to make something using it

Although my first experience with it wasn't very good HAHAHAHA
Either way, nice job man! :yay3ds:
It's the best way to implement multiplayer (at least local) on 5.6.6 as PIA doesn't work on that version. Need to explore devkitpro + unity stuff like you did with SD reading!
 
For anyone interested and pretty similar to TMP one shared here, I made a simple script that can be used with regular Text Mesh (not TMP) on 5.6.6 as it's not rendered properly by default (Feel free to modify anything you want):

C#:
using UnityEngine;

namespace VirtualPhenix.Nintendo3DS
{
    [ExecuteInEditMode]
    public class TextMeshApply3DSFixer : MonoBehaviour
    {
        [Header("Config"), Space]
        [SerializeField] protected bool m_applyOnStart = true;
        [SerializeField] protected bool m_applyInEditor = true;
        [SerializeField] protected bool m_createUniqueMaterial = true;
        [SerializeField] protected float m_cutoff = 0.5f;

        [Header("Shader Reference"), Space]
        [SerializeField] protected Shader m_shader;

        [Header("Component Reference"), Space]
        [SerializeField] protected TextMesh m_textMesh;
        [SerializeField] protected MeshRenderer m_meshRenderer;

        protected virtual void Reset()
        {
            CheckMissingComponents();
        }

        protected virtual void Awake()
        {
            CheckMissingComponents();
        }

        protected virtual void Start()
        {
            if (m_applyOnStart)
                Apply();
        }

#if UNITY_EDITOR
        protected virtual void OnValidate()
        {
            if (!Application.isPlaying && m_applyInEditor)
                Apply();
        }
#endif

        protected virtual void CheckMissingComponents()
        {
            if (m_textMesh == null)
                m_textMesh = GetComponent<TextMesh>();

            if (m_meshRenderer == null)
                m_meshRenderer = GetComponent<MeshRenderer>();
        }

        [ContextMenu("Apply 3DS Font Material")]
        public virtual void Apply()
        {
            if (m_textMesh == null || m_meshRenderer == null)
                return;

            if (m_textMesh.font == null)
            {
                Debug.LogWarning("No font assigned on " + gameObject.name);
                return;
            }

            Material fontMat = m_textMesh.font.material;
            if (fontMat == null)
            {
                Debug.LogWarning("Font has no material on " + gameObject.name);
                return;
            }

            Texture fontTex = fontMat.mainTexture;
            if (fontTex == null)
            {
                Debug.LogWarning("Font material has no mainTexture on " + gameObject.name);
                return;
            }

            Material newMat;

            if (m_createUniqueMaterial || m_meshRenderer.sharedMaterial == null)
                newMat = new Material(fontMat);
            else
                newMat = m_meshRenderer.sharedMaterial;

            if (m_shader != null)
                newMat.shader = m_shader;

            newMat.mainTexture = fontTex;

            if (newMat.HasProperty("_MainTex"))
                newMat.SetTexture("_MainTex", fontTex);

            if (newMat.HasProperty("_Color"))
                newMat.SetColor("_Color", m_textMesh.color);

            if (newMat.HasProperty("_Cutoff"))
                newMat.SetFloat("_Cutoff", m_cutoff);

            m_meshRenderer.sharedMaterial = newMat;
        }
    }
}

using this simple shader:

Code:
Shader "N3DS/3D TextMesh/3DTextMeshFont"
{
    Properties
    {
        _MainTex ("Font Texture", 2D) = "white" {}
        _Cutoff ("Alpha Cutoff", Range(0,1)) = 0.25
    }

    SubShader
    {
        Tags
        {
            "Queue"="AlphaTest"
            "IgnoreProjector"="True"
            "RenderType"="TransparentCutout"
        }

        Lighting Off
        Cull Off
        ZWrite On
        Fog { Mode Off }
        AlphaTest Greater [_Cutoff]

        BindChannels
        {
            Bind "Vertex", vertex
            Bind "Color", color
            Bind "TexCoord", texcoord
        }

        Pass
        {
            SetTexture [_MainTex]
            {
                combine primary, texture alpha
            }
        }
    }

    Fallback Off
}

So it moves from:

1775343398178.png


to this:

1775343419754.png
 
Last edited by Manurocker95,
Does anyone know why when converting Render Texture to regular render texture using

C#:
                Rect fullReadRect = new Rect(0, 0, m_captureRTWidth, m_captureRTHeight);
                m_captureReadTexture.ReadPixels(fullReadRect, 0, 0, false);
                m_captureReadTexture.Apply(false, false);


C#:
      UnityEngine.N3DS.Application.CaptureScreenshot(UnityEngine.N3DS.DisplayIndex.UpperDisplayForLeftEye, m_captureReadTexture);

Returns same colors btw.

m_captureReadTexture has all the pixels white?
Post automatically merged:

Does anyone know why when converting Render Texture to regular render texture using

C#:
                Rect fullReadRect = new Rect(0, 0, m_captureRTWidth, m_captureRTHeight);
                m_captureReadTexture.ReadPixels(fullReadRect, 0, 0, false);
                m_captureReadTexture.Apply(false, false);


C#:
      UnityEngine.N3DS.Application.CaptureScreenshot(UnityEngine.N3DS.DisplayIndex.UpperDisplayForLeftEye, m_captureReadTexture);

Returns same colors btw.

m_captureReadTexture has all the pixels white?
okay, it seems

Code:
   UnityEngine.N3DS.Application.CaptureScreenshot(UnityEngine.N3DS.DisplayIndex.UpperDisplayForLeftEye, m_captureReadTexture);

doesn't work on editor. It returns null pixels. However, it works on build. On the other hand, render texture Get Pixels doesn't work on build (N3DS) but works on editor.
 
Last edited by Manurocker95,
  • Like
Reactions: Th3Travler
Does anyone know why when converting Render Texture to regular render texture using

C#:
                Rect fullReadRect = new Rect(0, 0, m_captureRTWidth, m_captureRTHeight);
                m_captureReadTexture.ReadPixels(fullReadRect, 0, 0, false);
                m_captureReadTexture.Apply(false, false);


C#:
      UnityEngine.N3DS.Application.CaptureScreenshot(UnityEngine.N3DS.DisplayIndex.UpperDisplayForLeftEye, m_captureReadTexture);

Returns same colors btw.

m_captureReadTexture has all the pixels white?
Post automatically merged:


okay, it seems

Code:
   UnityEngine.N3DS.Application.CaptureScreenshot(UnityEngine.N3DS.DisplayIndex.UpperDisplayForLeftEye, m_captureReadTexture);

doesn't work on editor. It returns null pixels. However, it works on build. On the other hand, render texture Get Pixels doesn't work on build (N3DS) but works on editor.
I think there is a way to have one part of the shader be exclusive to unity and another be exclusive for the builds. Haven't tested it but i heard it works.. I think the combiner shader sample talks about it in the comments
 
I think there is a way to have one part of the shader be exclusive to unity and another be exclusive for the builds. Haven't tested it but i heard it works.. I think the combiner shader sample talks about it in the comments
Just using a render texture on non-3ds and screenshot on 3ds worked just fine (in this case).
 
  • Like
Reactions: Th3Travler
So I have finally been able to get back to this hobby project and Since windows 11 is such a privacy nightmare I have been decoupling from online services as much as possible ( yes good luck with that in our current software state of affairs :wacko:)
Its one of the reasons it been taking me so long to get back to this. little by little I have managed to get a working offline dev PC..

My question is are people here using Unity 5.6.5 and 5.6.6 offline? because i am having the devils time getting it to run without a web connection. I was able to get past the Unity Hub and run straight into the project but it hangs after the initial project compile. inspecting the editor logs I see it is trying to phone Unity web services and that seems to cause it to hang.

I also know there is a license check issue that needs resolving. from what i have figured out you can keep a local offline license
after you get it issued from unity servers. there is some license file with your local hardware ID entangled. So maybe you have to pop online once but after that if your license gets issued you can back it up and reuse... as long as your hardware ( mainly your motherboard doesn't change ) something about they use your ethernet identification id.

I'm just curious if anyone has solved / bypassed this - is aware of this "feature" Just feels a bit like all Unity needs to do is turn off a server and all legacy unity versions are dead on installation.
 
Last edited by Th3Travler,
So I have finally been able to get back to this hobby project and Since windows 11 is such a privacy nightmare I have been decoupling from online services as much as possible ( yes good luck with that in our current software state of affairs :wacko:)
Its one of the reasons it been taking me so long to get back to this. little by little I have managed to get a working offline dev PC..

My question is are people here using Unity 5.6.5 and 5.6.6 offline? because i am having the devils time getting it to run without a web connection. I was able to get past the Unity Hub and run straight into the project but it hangs after the initial project compile. inspecting the editor logs I see it is trying to phone Unity web services and that seems to cause it to hang.

I also know there is a license check issue that needs resolving. from what i have figured out you can keep a local offline license
after you get it issued from unity. there is some license file with your local hardware ID entangled. So maybe you have to pop online once but after that if your license gets issued you can back it up and reuse... as long as your hardware ( mainly your motherboard doesn't change ) something about they use your ethernet identification id.

I'm just curious if anyone has solved / bypassed this - is aware of this "feature" Just feels a bit like all Unity needs to do is turn off a server and all legacy unity versions are dead on installation.

I use 5.6.6f2 offline, yep. No issues at all. I don't launch the project through hub but the regular exe, tho. You just need to activate it once and that's it.
 
  • Like
Reactions: Th3Travler
I use 5.6.6f2 offline, yep. No issues at all. I don't launch the project through hub but the regular exe, tho. You just need to activate it once and that's it.
Well..today it can be done..tomorrow is another matter... *sigh* I am hoping for a less "dependent" solution.
I'm sure like all things it can be done probably has been done :lol:
I just hope if someone has that they share it :D - Thanks for the quick reply!
 
Well..today it can be done..tomorrow is another matter... *sigh* I am hoping for a less "dependent" solution.
I'm sure like all things it can be done probably has been done :lol:
I just hope if someone has that they share it :D - Thanks for the quick reply!

Hacking the editor with Unihacker bypasses completely the license check, btw.
 
  • Like
Reactions: Th3Travler
Actually on a total side Since I am rebuilding my dev PC figured I'd do it right this time

- How do you have your coding dev environment setup to work with 5.6.6?
- Are you using VS 2015? Pro or community? or a more modern /different IDE?
- what plugins do you have / use for your 5.6.6 projects?
-any folder / project / organization tips? ( I'm very green to Visual Studio )

As you know I'm not as experienced on the code side and am trying to build a solid foundation to start from. I can teach you anything you want from the art side but code and VS is something I use to poke with a stick from very far away:lol:.

There are a lot of tutorials out there but separating what actually works especially for a legacy version of Unity is quite challenging when you don't have the experience to judge if what is being taught is relevant / useful.
Post automatically merged:

Hacking the editor with Unihacker bypasses completely the license check, btw.
hukan***? github is gg
 
Last edited by Th3Travler,
Actually on a total side Since I am rebuilding my dev PC figured I'd do it right this time

- How do you have your coding dev environment setup to work with 5.6.6?
- Are you using VS 2015? Pro or community? or a more modern /different IDE?
- what plugins do you have / use for your 5.6.6 projects?
-any folder / project / organization tips? ( I'm very green to Visual Studio )

As you know I'm not as experienced on the code side and am trying to build a solid foundation to start from. I can teach you anything you want from the art side but code and VS is something I use to poke with a stick from very far away:lol:.

There are a lot of tutorials out there but separating what actually works especially for a legacy version of Unity is quite challenging when you don't have the experience to judge if what is being taught is relevant / useful.
Post automatically merged:


hukan***?

- I use Visual Studio 2022 (only because it's faster than VS2026). Unity 5.6.6 is from 2018, we had VS2019 back then with VSInstaller that updates the dependencies and the workflow didn't change much tbh. No need to even try to install VS2015.

- Depends on the game. In my case, in addition to my regular "core", I use DoTween, Enhanced Scroller and Cinemachine. If I need to setup cutscenes, Slate (as my port of timeline needs some work yet). In general old plugins and those that still support old versions like FinalIK will work on Unity 5.6.6 just fine. They probably hit performance on N3DS due to hardware limitations, tho.

- As Unity 5 doesn't support different assemblies, everything will go to Assembly-CSharp, so any organization that you like tbh. I prefer Assets/Projectname/Scripts/functionality/script.cs.

- 99% of the tutorials are pretty bad in general but they will work if you take 2019 ones or before or if you learn to "port" them to Unity 5. As I mention, Unity haven't changed its workflow in almost 10 years (until now with Unity 6).
 
Last edited by Manurocker95,
- I use Visual Studio 2022 (only because it's faster than VS2026). Unity 5.6.6 is from 2018, we had VS2019 back then with VSInstaller that updates the dependencies and the workflow didn't change much tbh. No need to even try to install VS2015.

- Depends on the game. In my case, in addition to my regular "core", I use DoTween, Enhanced Scroller and Cinemachine. If I need to setup cutscenes, Slate (as my port of timeline needs some work yet). In general old plugins and those that still support old versions like FinalIK will work on Unity 5.6.6 just fine. They probably hit performance on N3DS due to hardware limitations, tho.

- As Unity 5 doesn't support different assemblies, everything will go to Assembly-CSharp, so any organization that you like tbh. I prefer Assets/Projectname/Scripts/functionality/script.cs.

- 99% of the tutorials are pretty bad in general but they will work if you take 2019 ones or before or if you learn to "port" them to Unity 5. As I mention, Unity haven't changed its workflow in almost 10 years (until now with Unity 6).
ah community or pro VS? lol i meant VS plugins. So I just install 2022 and its good out the box for Unity 5?
intelisense and code context it knows all this?? or did you have to ..not sure what its called or phrased as.. add a library or pluging...something that VS didnt come with...When i was messing with 3DS shaders i had to get a i think it called a plugin that allowed the shader code to be properly be colored...formatted (intelisense?) sorry Im not very technical with VS yet that is why I ask.

Cinemachine!? I though that was a 2017 and on plugin..interesting!

as for unihacker - a hukan*** website ? The github site is no longer around..im shocked this was ever even on there :lol: seems it was an exe...
 

Site & Scene News

Popular threads in this forum