[0x00000] in filename unknow :0 error in log of Build

Hi everyone,

I quite confused because, my project is running well in editor runtime, but when I build it for PC, most of logic doesn’t work. I checked the log of build and there is error message in it:

NullReferenceException: Object reference not set to an instance of an object
at LightSaboteur.Awake () [0x00000] in filename unknown:0

(Filename: Line: -1)

Platform assembly: D:\Art\GameProjects\Builds\4_Data\Managed\Boo.Lang.dll (this message is harmless)
NullReferenceException: Object reference not set to an instance of an object
at LightSaboteur.Update () [0x00000] in filename unknown :0

(Filename: Line: -1)

NullReferenceException: Object reference not set to an instance of an object
at LightSaboteur.Update () [0x00000] in filename unknown :0

(Filename: Line: -1)

There is a code:

using UnityEngine;
using System.Collections;

public class LightSaboteur : MonoBehaviour {

CharacterSettings charSettings;
public GameObject debug;
Debuger debuger;
WeaponManager weapon;
Interactions interactions;
public GameObject testPoints;
public GameObject aimingObject;

//Equipment eq;

void Awake()
{
    charSettings = gameObject.GetComponent<CharacterSettings>();
   
    
    weapon = new WeaponManager();
    charSettings.Equipment.Weapon = weapon.buildWeaponByType((int)WeaponType.GigasLightPoliceRifle);
    charSettings.DelayDistance = 30f;
    charSettings.CloseDistance = 10f;
    charSettings.StopDistance = 7f;
    charSettings.NormalSpeed = 7f;
    charSettings.ChaseSpeed = 20f;
    charSettings.setAttackDistanceRange(10f, 30f);
    charSettings.addPatrollingArea(testPoints);
    charSettings.AimingObject = aimingObject;
    charSettings.Constitution.HealthPoints = 100;
    charSettings.Constitution.ArmorPoints = 20;
    
    interactions = gameObject.AddComponent<Interactions>();        //charAnimation = gameObject.AddComponent<CharacterAnimation>();

}

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {

    interactions.act();
}

}

Hrm, well are you controlling the order in which your classes are being instantiated, try moving the code from Awake to Start, that way you can be sure that things at least(should) exist. Awake is like unity’s constructor, but if you are not controlling the creation order, well you can get hosed very quickly.

As Landern mentioned, the issue was in Awake method, to resolve it I moved most of the stuff from Awake to Start method.