-1
\$\begingroup\$

I am trying to create my custom EditorWindow in Unity, using a Singleton structure for logic between Editor scripts

What is the proper way of creating Singleton in EditorWindow structure?

Maybe there are other patterns I can choose since I wasn't able to find any useful resource on the internet.

\$\endgroup\$
  • 2
    \$\begingroup\$ Can you expand on how you "failed"? What have you tried so far and how can we help you? \$\endgroup\$ – Gabriele Vierti Jan 30 at 14:44
  • \$\begingroup\$ There are a lot of good resources that come up with a simple search on the web; \$\endgroup\$ – Gabriele Vierti Jan 30 at 14:50
  • \$\begingroup\$ 2 reasons: 1) can't place Singleton in Editor folder 2) don't want to instantiate this singleton in the scene, since I don't need it in between the scene only while working in editor(not in runtime) \$\endgroup\$ – DMap Jan 30 at 14:52
  • 1
    \$\begingroup\$ You can't instantiate singletons. What do you mean by "I can't place a singleton in my editor folder"? I'd suggest you edit the question explaining in detail what is wrong with your code and what you expect your code to do. \$\endgroup\$ – Gabriele Vierti Jan 30 at 14:55
  • 1
    \$\begingroup\$ @DMap Have you considered to simply create a plain old C# class with some public static fields? \$\endgroup\$ – Philipp Jan 30 at 15:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.