• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by 2dkot · Jan 08, 2013 at 04:57 PM · build-error

[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();
 }

}

Comment
Add comment · Show 7
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Landern · Jan 08, 2013 at 05:01 PM 0
Share

Those are some nice exceptions, please post the offending code in the Awake and Update functions/methods of the LightSaboteur class.

avatar image 2dkot · Jan 08, 2013 at 05:17 PM 0
Share

I updated.

avatar image 2dkot · Jan 08, 2013 at 07:59 PM 0
Share

Any ideas?

avatar image 2dkot · Jan 08, 2013 at 08:15 PM 0
Share

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

avatar image 2dkot · Jan 08, 2013 at 08:40 PM 0
Share

U are absolutely right!!! Thanks a lot, can u please mark your comment as answer please ).

Show more comments

2 Replies

· Add your reply
  • Sort: 
avatar image
4
Best Answer

Answer by Landern · Jan 08, 2013 at 08:32 PM

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image _13PhysX · Dec 17, 2016 at 11:21 AM 0
Share

Its worthy, work for me

avatar image Shadoninja · Jun 17, 2018 at 05:46 PM 0
Share

Wow I just spent the last hour trying to debug a crazy NullReferenceException that would only show up in the standalone build of my game. It turned out I was using the Start() method to setup one of my $$anonymous$$onoBehaviors when I should have been using Awake() ins$$anonymous$$d. Not sure why the editor could survive the mistake and the standalone player couldn't... What a nightmare. Thanks!

avatar image
1

Answer by 2dkot · Jan 09, 2013 at 02:52 PM

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Landern · Jan 09, 2013 at 03:04 PM 0
Share

In that case i'll convert it to an answer. ;)

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

How can I stop the variable values reverting to its default values after being built? 1 Answer

Xcode gives directorynotempty error with UnityAds.bundle 0 Answers

Why I can't make games to Pc,Mac,Linux anymore? 2 Answers

Windows Store Build does nothing? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges