Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
1
Question by Ben Gannaway · Nov 18, 2009 at 11:17 AM · mono-behaviour

One of my scripts has no check-box next to it in Inspector

I have created an empty gameobject and dragged four scripts onto it to control various things. One of them has no check-box next to it in the inspector and one of the others isn't being instantiated properly, meaning I'm getting an error:

NullReferenceException: Object reference not set to an instance of an object

I am referencing them like this:

public class DataLayer : MonoBehaviour { private Configs configOb; private PageLoader pl;

void Start() { configOb = (Configs)gameObject.GetComponent(typeof(Configs)); //configOb = new Configs(); //pl = new PageLoader(); pl = (PageLoader)gameObject.GetComponent(typeof(PageLoader)); }

public ArrayList getTopApps() { ArrayList titleArray = new ArrayList(); string fetchUrl = configOb.getRoot()+"TopTen.php";

When I test this code it fails at the bottom line because the configOb is null.

Comment
Add comment · Show 1
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 stilos · Feb 27, 2015 at 11:51 PM 0
Share

I am having the exact same problem! while my scripting was working fine it stoped and i get the exact same message! and there is no tick box! what should i do?

2 Replies

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

Answer by runevision · Nov 18, 2009 at 01:49 PM

Your MonoBehaviour won't have a checkbox next to it in the inspector if it doesn't have any of the per-frame methods, like Update, FixedUpdate, OnGUI, etc.

I can't tell you why your configOb variable isn't being set properly. It may be due to something outside of the script you posted.

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 Ben Gannaway · Nov 18, 2009 at 03:29 PM 0
Share

Ok, thanks. I can't figure out why it wont initiate my scripts

avatar image yadoa · Nov 28, 2012 at 08:57 AM 0
Share

thank you.

avatar image
2

Answer by Jormungandr · Nov 18, 2009 at 06:11 PM

Is getTopApps() called by another script's Start() method? If so, it may be running before DataLayer.Start() is.

The convention I usually follow to avoid this is to put all reference assignment (GetComponent, Find, etc) in Awake, while startup functionality that relies on such references always goes in Start.

Comment
Add comment · 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

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.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

How can i use the method of a non monobehaviour class in my normal scripts. 3 Answers

Call the destructor of MonoBehaviour. 1 Answer

Why are my MonoBehaviour methods not called? 1 Answer

Changing the Inspector Titlebar icon, and Text? 3 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