In Unity, how can I pass values from one script to another?

后端 未结 4 1039
陌清茗
陌清茗 2020-11-27 18:48

In Unity, I want one object to have a falling speed variable that all the other objects can access. For various reasons, I can\'t use the inbuilt gravity for what I\'m tryin

4条回答
  •  温柔的废话
    2020-11-27 19:48

    If I were you I would just make this speed variable "static public" so you can access it from anywhere. You should always avoid "find.anything" etc functions, they are quite slow. There is no reason for you to look for something that you exactly know where it is.

提交回复
热议问题