Good day!

Very often the following question arises: if a method does not relate logically to a given class, and you don’t want to create a class with a single method, then how to be in such situations? The logic in many classes is superfluous, but necessary. For example, a method that mixes the values ​​of an array in a script that generates blocks.

I want the code to be as simple as possible. Can you tell me how best to structure the code in Unity projects?

PS * class - the next MonoBehaviour class. (component, script)

  • 2
    I don’t know how about Unity, but if you need to put a utility method somewhere that doesn’t belong to your logic and does some small operation (for example, mix values ​​in an array) - then you can do it using the extension method - tym32167
  • one
    I for such things create one class Utils and there I push all these methods. - Suvitruf

0