private void Awake() { if (instance == null) { instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(this.gameObject); } }
void Awake() { spRend = gameObject.GetComponent <SpriteRenderer> (); Vector2 size = SplashScreenScript.getSize(), rSize = spRend.bounds.size; Vector3 scaleToApply; if (!scaleToFill) { float scale = Mathf.Min(size.x / rSize.x, size.y / rSize.y); scaleToApply = new Vector3(scale, scale, 1); } else { scaleToApply = new Vector3(size.x / rSize.x, size.y / rSize.y, 1); } transform.localScale = Vector3.Scale(transform.localScale, scaleToApply); }
void OnEnable() { script = (SplashScreenScript)target; }