Skip to main content
4 of 4
grammar and punctuation
Gnemlock
  • 5.3k
  • 5
  • 30
  • 60

Null instance on manager class extending from singleton class

I have four classes:

  • class A, which is abstract and partial extending from singleton class C.
  • class A1, which is partial and extending from class A .
  • class B, extending from class A.
  • class C, a singleton which has code to throw an exception if the instance is null, and otherwise uses DoNotDestroyOnLoad().

In scene view, I add class B to the scene. It works, but throws a null instance exception for class A, as it's instance is not present in scene. I think this is because class A extends from a singleton class, and it has ability to throw exceptions when the instance is null. I can not add the class A to the scene because it is abstract.

What can I do to in order to add the class A component to the scene, or otherwise not to get this error?