Search Unity

Creating a cs file of global functions

Discussion in 'Scripting' started by oliver_unity892, Jan 11, 2020.

  1. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    55
    Hi all

    I have a load of common functions that I paste in to most of my cs files. That works but is like to compile them in to one cs file that is available to any function/script in my game.

    This is for this like a common log writing routine, or even a global variable that flags whether npcs on a scene should move or not.

    I wonder whether I need to create a namespace but I'm not really sure what to search for in the Unity word.

    Any pointers?
     
  2. WarmedxMints

    WarmedxMints

    Joined:
    Feb 6, 2017
    Posts:
    1,035
    For something like that, one way would be to could create a helper class with static methods.
     
unityunity