/// Create the reference to the brain public void SetBrain(Brain b) { brain = b; if (trainer) { trainerInterface = trainer.GetComponent <ITrainer>(); Debug.Assert(trainerInterface != null, "Please make sure your trainer has a monobehaviour that implement ITrainer interface attached!"); trainerInterface?.SetBrain(b); } }