Enforcing components

As we did with the other scripts in this book, once again we need to enforce the components, so we can write:

using System.Collections; 
using System.Collections.Generic; 
using UnityEngine; 
 
[RequireComponent(typeof(Rigidbody2D))] 
[RequireComponent(typeof(Collider2D))] 
public class BulletController : MonoBehaviour { 
//[...] 
} 
..................Content has been hidden....................

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