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
0
Question by venhip · Nov 23, 2012 at 08:19 PM · integerskillsburgzergarcade

Problem displaying an int

Hey, I've just been following BurgZergArcade's tutorials and I seem to have made a typo causing an "Object reference not set to an instance of an object" error to be printed many times a second and I cant for the life of me find where I've gone wrong (I've spent the last hour going over the videos again but to no avail.) Could someone please point out where I've gone wrong? I'll be extremely grateful.

GUI display code for the integer:

     private void DisplaySkills(){
 
             for(int cnt = 0; cnt < Enum.GetValues(typeof(SkillName)).Length; cnt++) {
             
             GUI.Label(new Rect(250, 50 + (cnt * 25), 100, 25), ((SkillName)cnt).ToString());
             GUI.Label(new Rect(355, 50 + (cnt * 25), 30, 25), _toon.GetSkill(cnt).AdjustedBaseValue.ToString());
         }
 
         
     }

And the script for setting up the skills:

 public class Skill : ModifiedStat {
 
     private bool _known;
     
     public Skill(){
         
         _known = false;
         ExpToLevel = 25;
         LevelModifier = 1.1f;
     }
     
     public bool Known {
         
         get{ return _known;}
         set{ _known = value; }
     }
 }
 
 public enum SkillName{
     
     Melee_Offence,
     Melee_Defense,
     Ranged_Offence,
     Ranged_Defense,
     Magic_Offence,
     Magic_Defense
 }
 

Many thanks.

EDIT: The scripts for the vital stats and attributes work fine.

Comment
Add comment · Show 2
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 Dave-Carlile · Nov 23, 2012 at 09:14 PM 0
Share

Where does the error occur? You should be able to double click the message in the console and have it take you to the specific line.

avatar image venhip · Nov 23, 2012 at 09:44 PM 0
Share

Oh, sorry, if forgot to put that: line 60 or rather the second GUI.Label in the top code, I have the same code (but with 'SkillName' & 'GetSkill' replaced with relevant variable) for attributes and vitals and they work fine.

1 Reply

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

Answer by venhip · Nov 25, 2012 at 04:15 PM

After playing around for a little while I have found out what is wrong, or at least what is causing the errors. I'll close this question and open another with an appropriate heading.

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

11 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

Related Questions

Error calling enum lists 1 Answer

Is there a setting to change integer rounding to 'Swedish Rounding'? 2 Answers

Is there a way to use integers greater than unity's infinity? 2 Answers

Why can't I use uint for the inspector? 3 Answers

Change Integer to All Gameobjects With Script 1 Answer


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