public void Init() { bool wasDeactivated = false; if (sprite != null) { // See if we need to activate our sprite // to work with it: if (!sprite.gameObject.active) { wasDeactivated = true; sprite.gameObject.active = true; } anim = sprite.GetAnim(animName); if (anim == null) { Debug.LogError("SuperSprite error: No animation by the name of \"" + animName + "\" was found on sprite \"" + sprite.name + "\". Please verify the spelling and capitalization of the name, including any extra spaces, etc."); } if (wasDeactivated) { sprite.gameObject.active = false; } } }
public void Init() { bool wasDeactivated = false; if (sprite != null) { // See if we need to activate our sprite // to work with it: #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 if (!sprite.gameObject.activeInHierarchy) { wasDeactivated = true; sprite.gameObject.SetActive(true); } #else if (!sprite.gameObject.active) { wasDeactivated = true; sprite.gameObject.active = true; } #endif anim = sprite.GetAnim(animName); if (anim == null) { Debug.LogError("SuperSprite error: No animation by the name of \"" + animName + "\" was found on sprite \"" + sprite.name + "\". Please verify the spelling and capitalization of the name, including any extra spaces, etc."); } if (wasDeactivated) #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9 { sprite.gameObject.SetActive(false); } #else { sprite.gameObject.active = false; } #endif } }