阅读背景:

是否有更有效的方法来禁用多个脚本,同时在Unity中的单个游戏对象上保持一些活动?

来源:互联网 

I am trying to turn off all components instead of one of them on a Game Object based off of which number is chosen as the index. The code is longer than this but I am trying to figure out if there is a more efficient way to doing so rather than calling so many GetComponents. When running this code I am getting a StackOverflowException and I think it is because of how many time I am calling GetComponent. The idea that I had was to put each GetComponent into an array and if the index matches the array number than make that component true and make the rest false. I that is the right direction can some help me in the right direction on how I create arrays out of scripts. I am trying to turn off all components instead




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: