Unity3d-Finite-State-Machine icon indicating copy to clipboard operation
Unity3d-Finite-State-Machine copied to clipboard

A different script for each state

Open amromezzat opened this issue 2 years ago • 2 comments

Would it be possible to have a separate script for each state? As it stands right now, the single FSM script can grow very long.

amromezzat avatar Mar 12 '22 13:03 amromezzat

given the nature of this FSM, i would suggest to use partial class to "split" your methods into separate files, while keeping it in the same class.

fakegood avatar Mar 13 '22 02:03 fakegood

Thank you, @fakegood. I am now using partial classes. My only problem lies in initialization and assertions since I have to hope between the Main class file and the other derivative files.

amromezzat avatar Mar 26 '22 19:03 amromezzat