Hi, please consider the following: (all in c#)
interfaces:
public interface ITypeA
{
ITypeB { get; set; }
}
public interface ITypeB { }
container class:
public class OuterContainer : MonoBehaviour, ITypeA
{
void Awake()
{
if (InnerObjectB == null) InnerObjectB = AddComponent<InnerClass>();
}
ITypeB InnerObjectB { get; set; }
}
inner class:
public class InnerClass : MonoBehaviour, ITypeB
{
// Some implementation
}
script:
private OuterContainer storage;
void Awake()
{
DontDestroyOnLoad(this);
var component = AddComponent<OuterContainer >();
storage = component;
}
What I am seeing happen is the following:
The normal MonoBehaviour methods (Awake, Start, Update etc) are called on all objects (the script, Outer container and inner class) as normal in the first scene. Then when the scene is changed using LoadLevel although the script still is called as normal, the ‘InnerClass’ object no longer receives any MonoBehaviour calls (although it does exist!)
Can anybody shed any light on why this might be happening?