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 Ian-McCleary · Apr 28, 2014 at 12:02 AM · javascriptdebug

Not getting a Debug.Log

I have a crafting script for some reason im not getting the Debug.Log("Ammount1"), Debug.Log("Add"), or Debug.Log("Add1"), but i am getting Debug.Log("Ammont").

I think it has something to do with the brackets that i placed but because im pretty new to Unity and Javascript, I dont really know what way they should go. I think it is the Brackets because im its not subtracting the Ammount variables. If you know what the problem is or what i need to do to keep it working but rearrange the brackets please leave a comment or an answer!

I have left the section of the script below. I am sorry im not very knowledgeable in coding and Thank you in advance!

 function Craft2 ()
 {
     if(Crafting[2] == true)
 {
 Debug.Log("Ammount");
 
     if(Ammount[0] >=2 && Ammount[1] >=1)
 {
     if(CraftingNumber >= NewTexture.Length)
 {
 Ammount[0]-=2;
 Ammount[1]-=1;
 Ammount[2]+=1;
 Debug.Log("Ammount1");
 
     if(NewTexture[CraftingNumber] != Blank )
 {
 CraftingNumber ++;
 Debug.Log("Add");
 }
 
     if(NewTexture[CraftingNumber] == Blank )
 {
 NewTexture[CraftingNumber] == AllTextures[2];
 Debug.Log("Add1");
 }
 }
 
 if(CraftingNumber < NewTexture.Length)
 {
 CraftingNumber = 0;
 Crafting[2] = false;
         }
     }
 }
 }
Comment
Add comment
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

2 Replies

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

Answer by getyour411 · Apr 28, 2014 at 12:44 AM

Your debugs are essentially based on passing your if() conditions, so that's really the root cause and probably nothing to do with brackets/debug.log per se. The simplest way (without using steps in Mono) is just to put more debugs like after line 7 do debug.log ("passed ammount[0] and [1] check") and then again on the next if, and so on. I think you'll find your if() conditions aren't working as expected

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
avatar image
0

Answer by Jeff-Kesselman · Apr 28, 2014 at 01:17 AM

Make sure logging messages are enabled on the console...

All enabled looks like this

alt text

All disabled looks like this

alt text

Its a bit hard to see in those screen shots, but enabled is grey, disabled is black. If unsure, then click on them and pif they get darker, click again.


screen shot 2014-04-27 at 9.21.28 pm.png (8.6 kB)
screen shot 2014-04-27 at 9.20.44 pm.png (12.1 kB)
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 Ian-McCleary · Apr 28, 2014 at 01:37 AM 0
Share

They are enabled because i was getting the first few Debug.Log messages...I think its my if statement on line 16

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

21 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Can someone help me fix my Javascript for Flickering Light? 6 Answers

Setting Scroll View Width GUILayout 1 Answer

It is not possible to invoke an expression of type 'UnityEngine.GameObject'? 1 Answer

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

Error Unexpected token } 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