public void SetData(PlatformData data) { this.data = data; if (spriteRenderer == null) { InitializeSprite(color); } var width = data.GetWidth(); transform.localScale = new Vector3(width, 3, 1); UpdatePosition(); mouse = gameObject.AddComponent <MouseObserver>(); }