Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

Making a score display on a 3d text object

Discussion in 'Scripting' started by Zefyros, May 22, 2019.

  1. Zefyros

    Zefyros

    Joined:
    May 22, 2019
    Posts:
    3
    I'm trying to get a score to show up on a 3D-text object but I'm unable to get it working

    Here's the code I have on the object that triggers what should be an added point
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4.  
    5.  
    6. public class kaatunut : MonoBehaviour {
    7. public Countertop ct;
    8.  
    9.  
    10.     // Use this for initialization
    11.     void Start () {
    12.  
    13.     }
    14.  
    15.     // Update is called once per frame
    16.     void Update () {
    17. if (transform.up.y < 0.5)
    18. {
    19. ct.count = ct.count + 1;
    20. this.enabled = false;
    21.  
    22.  
    23. }
    24. }
    25. }
    26.  
    and heres the 3D text script
    Code (CSharp):
    1.  
    2. using UnityEngine;
    3.  
    4. public class Countertop : MonoBehaviour {
    5.  
    6.  
    7. public float count;
    8.  
    9. public GUIText countText;
    10.     // Use this for initialization
    11.     void Start () {
    12.         count = 0f;
    13.  
    14.     }
    15.  
    16.     // Update is called once per frame
    17.     void Update () {
    18.  
    19.  
    20.     }
    21. }
    22.  
    23.  
    I'm also unable to Place the text objects script on the reference slot I've made for it
     
    Last edited: May 22, 2019