Exposing variables in the Inspector

In order to let designers customize the bullet according to the gameplay of the game, we need to expose some variables by declaring them public. This concept should be clear by now. In particular, we want to expose the speed at which the bullet moves, and the time before it is destroyed in case it didn't hit anything. This last one is just an optimization since we don't want bullets going around in our game world in regions that are not visible.

So, here are the two public variables we need:

// [...] 
public class BulletController : MonoBehaviour { 
 
    public float speed = 10.0f; 
 
    public float timeBeforeDestruction = 10.0f; 
 
   // [...] 
} 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset