- Home /
Question by
roberto_sc · Nov 05, 2013 at 06:22 AM ·
bugnullreferenceexceptionrequirecomponentwindows-8
RequireComponent not working!
I have a script that requires a Camera. It loads itself when calling one of its static methods:
[RequireComponent(typeof(Camera), typeof(GUILayer))]
public sealed class SomeManager : MonoBehaviour
{
static SomeManager()
{
new GameObject("SomeManager", typeof(SomeManager));
}
It works very well when I'm on editor, but when I compile to Windows Store Apps, I get a null reference exception on Awake
:
private void Awake()
{
camera.cullingMask = 1 << LayerMask.NameToLayer("Background");
Because camera is null
! This is a bug, right?
Comment
Your answer
