Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Question The type or namespace name 'Singleton<>' could not be found

Discussion in 'Scripting' started by Exarpo, Sep 5, 2020.

  1. Exarpo

    Exarpo

    Joined:
    Nov 25, 2019
    Posts:
    51
    Closed
     
    Last edited: Sep 5, 2020
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,947
    Correct.
    If you want to use a class called Singleton you need to either write one or copy a script from the internet into your project.
     
  3. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,606
    Just to be clear, the error message is also not just build in to be shown to you without any cause. So you probably copied code online which relies on said Singleton class to function, which you did not copy alongside the rest of the code. So it's probably a good idea to go back to the tutorial you followed and see what you missed.
     
    PraetorBlue likes this.
  4. Exarpo

    Exarpo

    Joined:
    Nov 25, 2019
    Posts:
    51
    Well I don't think i missed any part of the tutorial but i ended up going after anotehr tutorial so this thread is irrelevant now.
    thanks anyway
     
  5. Yoreki

    Yoreki

    Joined:
    Apr 10, 2019
    Posts:
    2,606
    Well, you missed the part where the tutorial introduces the Singleton class. And be it only a "you can get this in the video description". But if it runs in the tutorial and not for you, then you most definitely missed that part.

    While it may seem like the path of least resistance, it doesnt really help to just dodge a problem without finding a fix for it. You will eventually run into similar problems again. Anyways, if you dont want any more help i just wish you luck with your new approach.
     
    Last edited: Sep 5, 2020
    PraetorBlue likes this.
  6. Exarpo

    Exarpo

    Joined:
    Nov 25, 2019
    Posts:
    51
    Yeah you are right with the fact that dodging a problem isn't the best way to go, but I really want to finish a project I'm working on :/. And I think that the tutorial actually did not contain the part about the SIngleton class as it probably was a tutorial ment for people who already understand this kind of stuff.
    I came across this problem when following a tutorial about the unity IAP Service, after following another tutorial I came across a different problem, could you take a look at that as you seem quite experienced in terms of unity.
    https://forum.unity.com/threads/cant-add-unity-iap-button-after-importing-iap-services.964844/