void OnEnable()
        {
            if (instance == null)
            {
                instance = Instantiate(this, barPrefab, canvas, worldCamera, attachPoint, networkInstantiate, networkGroup, updateLookupReference);
            }

            if (instance != null)
            {
                instance.gameObject.SetActive(true);
            }
        }
        void OnEnable()
        {
            if (instance == null)
            {
                instance = Instantiate(this, barPrefab, canvas, worldCamera, attachPoint,
#if UNITY_PRE_2018_2
                                       bool networkInstantiate, int networkGroup,
#endif
                                       updateLookupReference);
            }

            if (instance != null)
            {
                instance.gameObject.SetActive(true);
            }
        }
        public static EnergyBarUGUIBase Instantiate(Object parent, EnergyBarUGUIBase barPrefab, ObjectFinder canvasFinder, ObjectFinder cameraFinder, Transform attachPoint,
#if UNITY_PRE_2018_2
                                                    bool networkInstantiate, int networkGroup,
#endif
                                                    bool updateLookupReference)
        {
            EnergyBarUGUIBase bar;

#if !(UNITY_FLASH || UNITY_NACL || UNITY_METRO || UNITY_WP8 || UNITY_WEBGL) && UNITY_PRE_2018_2
            if (networkInstantiate)
            {
                bar = Network.Instantiate(barPrefab, barPrefab.transform.position, barPrefab.transform.rotation, networkGroup) as EnergyBarUGUIBase;
            }
            else
            {
                bar = Instantiate(barPrefab) as EnergyBarUGUIBase;
            }
#else
            bar = Instantiate(barPrefab) as EnergyBarUGUIBase;
#endif
            if (canvasFinder.chosenMethod == ObjectFinder.Method.ByType)
            {
                bar.transform.SetParent((canvasFinder.Lookup <Canvas>(parent)).transform, true);
            }
            else
            {
                bar.transform.SetParent((canvasFinder.Lookup <Transform>(parent)), true);
            }

            var followObject = bar.GetComponent <EnergyBarFollowObject>();
            if (followObject == null)
            {
                followObject = bar.gameObject.AddComponent <EnergyBarFollowObject>();
            }

            followObject.worldCamera           = cameraFinder;
            followObject.followObject          = attachPoint.gameObject;
            followObject.updateLookupReference = updateLookupReference;

            return(bar);
        }