Skip to content

SubController

Feynmen edited this page Jun 18, 2018 · 4 revisions

SubControllerBase

This class you can use if you want to separate the logic of your controller. You must manually initialize SubControllers like Views

SubControllerBase Features

For cleaning data, you can override function Release, which will be invoked when a component Destroying

public override void Release() 
{ 
    //Remove some data
}

SubControllerBase Example

SubController

public class TestSubController : SubControllerBase 
{	
    public override void Init() { }
}

Controller

public class TestController : ControllerBase
{
    [SerializeField] private TestSubController _testSubController;
		
    protected override void Init()
    {
        _testSubController.Init();       
    }
}

Clone this wiki locally