Most efficient way to code with inputs/vars

Hello Unity Community,

I am thinking about the most efficient way to code something. Let me explain a little first. (Sry for bad english too)

So imagine i have 2 scripts one for movement and one for my cam;

One of them checks for input and stores it in variables;
I also need this vars/values in the other script, so i can work with them;

So i always think about possibilities:

  1. Method
    I declare a var with the script type to get the public vars and methods from the other script;

  2. Method
    I create a extra script only for vars to read from it;

  3. Method
    I use the scripting again to get input data from the Unity Engine;

  4. and so on
    You guys tell me…

So my question is, what is the most efficient way to work with vars?
Or is one of the methods unefficient or bad.

Or have you guys other ideas for better scripting in Unity;

Thank you and best regards
Nuri

I think that noones of the methods are efficient
1-2) You would have dependecies and messy code β†’ Take a look here: https://unity3d.com/how-to/architect-with-scriptable-objects
3) Redundant code β†’ Take a look to classes

1 Like

Ok i was kinda new into game architectures but this helped a lot to find my way into this topic. Thank you.