Candy Smith
HomeGeneral Info
Bubble Shooter Toolkit
Bubble Shooter Toolkit
  • Getting started
    • Specification
  • TUTORIALS
    • Video Tutorials
    • Level EDITOR
    • How to set or create in-game tutorials
    • How to expand map and add new points
    • Adding new ball
    • Coins SHOP
    • Ads setup
      • Ads mediation (Levelplay/IronSource) setup
      • Admob setup
      • Unit ads legacy setup
      • Ads settings
      • Add rewarded ads button
    • Settings
      • Game settings
      • Gameplay settings
      • Boost settings
      • Shop settings (IAP)
      • Daily bonus settings
      • Lucky spin settings
      • Powerup settings
      • Target settings
      • Debug Settings
  • Scripts
    • Scripts Overview
      • Ball spawner
      • EventManager
      • GetNeighbours
      • Resource system
      • Playable item types
Powered by GitBook
On this page
  1. Scripts
  2. Scripts Overview

Ball spawner

This method would be called when there's a need to spawn a new Ball in the game, such as at the start of a level or when a player makes a move that generates a new Ball. Use name of the prefab in parameter. Use SetPosition to put ball to the static position on the field.

Here's an example of how to use the BallPool to create a ball with a random color:

var ball = PoolObject.GetObject("Ball 0").GetComponent<Ball>();
ColorManager.instance.GenerateColorInGame());

// set position on the field
ball.SetPosition((col,row));

In this case, we're creating a new ball at position (0,0) with a random color. The color is determined by passing the integer equivalent of EBallColor.RandomColor to the SpawnBall method. This enum value tells the method to assign a random color to the ball.

Last updated 1 year ago