Search Unity

Both are prebabs, how to get score count form both prefabs

Discussion in 'Scripting' started by lakhbir, Aug 27, 2015.

  1. lakhbir

    lakhbir

    Joined:
    May 15, 2015
    Posts:
    15
    hlo m trying to count score but my score count script attached on rocket and rocket is instiate object afet hit with enemies it distroyed . score debug work but not acces it
     
  2. Timelog

    Timelog

    Joined:
    Nov 22, 2014
    Posts:
    528
  3. LeftyRighty

    LeftyRighty

    Joined:
    Nov 2, 2012
    Posts:
    5,148
    you want the score to be held on an object that persists. Setup a ScoreManager script to hold the value and attach it to an empty gameobject, have the "scoring" event (killing the bad guys, collecting coins, whatever) look for that script and update it. The ScoreManager can then handle the display via a canvas or whatever is needed.
     
  4. lakhbir

    lakhbir

    Joined:
    May 15, 2015
    Posts:
    15
    thank you Timelog and LeftyRghty..for seggestion
    m success for fixed this issues with the help of get component and call another script...