Advertisement
shadowplaycoding

P016_GUIManagementScript

Apr 29th, 2017
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.19 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4.  
  5. public class GUIManagementScript : MonoBehaviour {
  6.  
  7.     public static GUIManagementScript GUIManagerInstance;
  8.  
  9.     public List<GameObject> namePlates;
  10.  
  11.    
  12.  
  13.     void OnEnable()
  14.     {
  15.         GUIManagerInstance = this;
  16.         namePlates = new List<GameObject>();
  17.     }
  18.  
  19.     // Use this for initialization
  20.     void Start () {
  21.        
  22.     }
  23.    
  24.     // Update is called once per frame
  25.     void Update () {
  26.  
  27.         if(namePlates.Count > 0)
  28.         {
  29.             for(int i = 0; i < namePlates.Count; i++)
  30.             {
  31.                 namePlates[i].transform.LookAt(Camera.main.transform);
  32.                 float rotY = namePlates[i].transform.localEulerAngles.y + 180f;
  33.                 namePlates[i].transform.localEulerAngles = new Vector3(
  34.                     -namePlates[i].transform.localEulerAngles.x,
  35.                     rotY,
  36.                     -namePlates[i].transform.localEulerAngles.z);
  37.             }
  38.         }
  39.  
  40.     }
  41.  
  42.     /*
  43.     Copyright Shadowplay Coding 2017 - see www.shadowplaycoding.com for licensing details
  44.     Removing this comment forfits any rights given to the user under licensing.
  45.     */
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement