Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by DewDoughnut · Apr 01, 2019 at 04:17 PM · uiscorescore systemchild-to-gameobject

score not increasing and staying at 1

im trying to make a game like pipe dream. i have a system where you have a score for where objects are if your score is greater than the max score you change levels. if the thing is a child of a certain tag score goes upwards. however score isnt going upwards and is simply staying at 1 the boolean for if its on the right thing is true so it should add to the score. whats the problem i cant see it.![alt text][1]

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.SceneManagement;
 
 public class DetectionScript : MonoBehaviour {
     public int score;
     public bool pointAdded;
     public int MaxScore;
     public int add;
 
     // Use this for initialization
     void Start () {
         MaxScore = 9;
         score = 1;
         pointAdded = false;
         add = 1;
     }
 
     // Update is called once per frame
     void Update()
     {
         if (transform.parent.tag == "Horiz" && !pointAdded)// if points added = true and its parent is whatever do this
         {
             score = score ++;
             pointAdded = true;
             Debug.Log(score + " this sucks" + pointAdded);
         }
 
         if (transform.parent.tag == "Vert" && !pointAdded) //if points added = true and its parent is vert and it is rotated 90 on its z
         {
             score = score ++;
             pointAdded = true;
             Debug.Log(score + " this sucks" + pointAdded);
         }
 
         if (transform.parent.tag == "TL" && !pointAdded)//its parent is tl
         {
             score = score ++;
             pointAdded = true;
             Debug.Log(score + " this sucks" + pointAdded);
         }
         if (transform.parent.tag == "TR" && !pointAdded)//its parent is tr
         {
             score = score ++;
             pointAdded = true;
             Debug.Log(score + " this sucks" + pointAdded);
         }
         if (transform.parent.tag == "BL" && !pointAdded)// its parent is bl
         {
             score = score++;
             pointAdded = true;
             Debug.Log(score + " this sucks" + pointAdded);
         }
         if (transform.parent.tag == "BR" && !pointAdded)// its parent is br
         {
             score = score++;
             pointAdded = true;
             Debug.Log(score + " this sucks" + pointAdded);
         }
         if (transform.parent.tag == "Blank") // copy and paste this on the thing you dont want to give points  if blank no points
         {
             score = 0;
             pointAdded = false;
             Debug.Log(score + " this sucks" + pointAdded);
         }
         if (score >= MaxScore)
         {
             SceneManager.LoadScene("basics scene should be good");
         }
     }
 }
 

`

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 xxmariofer · Apr 01, 2019 at 08:04 PM 0
Share

can you debug.log the pointadded value? also make sure all tags are right spelled since its a common mistake not having caps etc

avatar image DewDoughnut · Apr 02, 2019 at 10:38 AM 0
Share

the debug.log shows points added value as true meaning that they are in the right place so i dont know what the problem is

avatar image xxmariofer DewDoughnut · Apr 02, 2019 at 11:02 AM 0
Share

Thats the problem is obly entering the if statement if its false since you are using a !

avatar image DewDoughnut xxmariofer · Apr 03, 2019 at 01:18 PM 0
Share

i removed the hashtag and what happens is that the debug.log keeps continually logging for each second and the score doesn't go upwards.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by DewDoughnut · Apr 02, 2019 at 10:26 AM

the debug.log for points added comes up as true

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

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

Related Questions

I have a score displayed constantly in my game, but I can't get it to work for my game-complete screen? Help? 0 Answers

Scoring Points with UI Text 0 Answers

How does one reference a UI instance from a prefab? 1 Answer

Scoring Points with UI Problem! 0 Answers

UI text script working on an object but not working on copied object 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