Example #1
0
        private void Awake()
        {
            GameObject resourceTracker = uGUI.main.gameObject.transform.Find("ScreenCanvas/ResourceTracker").gameObject;

            uGUI_ResourceTracker uGUI_ResourceTracker = resourceTracker.GetComponent <uGUI_ResourceTracker>();

            blip = UWE.Utils.InstantiateDeactivated(resourceTracker.transform.Find("blip").gameObject);
            blip.transform.SetParent(transform, false);
            blip.name = "blip";

            GameObject distanceText = Instantiate(blip.transform.Find("text").gameObject, blip.transform);

            distanceText.name = "distanceText";
            distanceText.SetActive(false);

            Color color = new Color(1, 0, 0, 1);

            TextMeshProUGUI tmproDist = distanceText.GetComponent <TextMeshProUGUI>();

            tmproDist.color = color;

            TextMeshProUGUI tmproText = blip.transform.Find("text").GetComponent <TextMeshProUGUI>();

            tmproText.color = color;

            RectTransformExtensions.CenterRect(distanceText.transform as RectTransform, Vector2.zero);

            Image image = blip.GetComponent <Image>();

            image.color = color;

            mainCanvas = UWE.Utils.InstantiateDeactivated(resourceTracker.transform.Find("mainCanvas").gameObject);
            mainCanvas.transform.SetParent(transform, false);
            mainCanvas.name = "mainCanvas";
        }