Search Unity

Question about the unity tutorial's FSM with scriptable object design

Discussion in 'Scripting' started by sarah22, Oct 23, 2018.

  1. sarah22

    sarah22

    Joined:
    Aug 6, 2017
    Posts:
    15
    Is it ok to have all these variables accessible by action/decision objects in state controller class?

    Code (CSharp):
    1. [HideInInspector] public NavMeshAgent navMeshAgent;
    2. [HideInInspector] public Complete.TankShooting tankShooting;
    Here's the link to unity's FSM tutorial: https://unity3d.com/kr/learn/tutorials/topics/navigation/questions-and-answers?playlist=17105

    I'm asking because right now I have a bunch of these variables sitting around because I have so many components, states and decisions. I just want to know that I'm doing it right now than later.

    Thank you.
     
  2. If you're learning the FSM-stuff, do not worry about anything else, do the way you can. Later, when you will have enough experience with it, you can adjust your code style and can follow the "best practices".
    The code should work first, it can be beautiful later.