Quantcast
Channel: Questions in topic: "count"
Viewing all articles
Browse latest Browse all 187

counting of two different objects

$
0
0
Hello there. I created two separate objects. When I press the A button, I hit the basketball and when I press the K key, the capsule falls. I've set an area and I want to keep the number of basketball balls and capsules falling apart. When any object falls into the field, two numbers are increasing at the same time. The number of bounces after a fall, the second time falls to the number is increasing one more. How can I fix this? using System.Collections; using System.Collections.Generic; using UnityEngine; public class objegirdisi : MonoBehaviour { public GUIStyle puanstil; public GUIStyle kapsulstil; private int topadet=0; private int kapsuladet = 0; // Use this for initialization void Start () { } // Update is called once per frame void Update () { } void OnTriggerEnter(Collider go) { topadet++; kapsuladet++; Debug.Log("Kutu Icerisine Giren Nesne: "+go.name); } void OnGUI() { GUI.Label(new Rect(0,0,Screen.width,50),topadet+"",puanstil); GUI.Label(new Rect(0, 30, Screen.width, 50), kapsuladet + "", kapsulstil); } }

Viewing all articles
Browse latest Browse all 187

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>