###### tags: `Unity C# 好用寫法` [toc] # Script 常用 # 抓不同script的變數 ## 方法一 ```csharp= public GameObject variable_name; GameObject.GetComponent<Script_Name>().variable_name; ``` ## 方法二(效率較差) **被讀取的script** ```csharp= public static data_type variable_name; ``` **讀取的script** ```csharp= script_name.variable; ``` # 腳本停用 ```csharp= GameObject.Find("Object_Name").GetComponent<Scrpit_Name>().enabled = true / False ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up