Timeline for How to access a variable from another C# script in Unity
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jun 16, 2020 at 10:15 | history | edited | CommunityBot | Commonmark migration | |
| Jan 8, 2016 at 17:24 | comment | added | Draco18s no longer trusts SE | How you write a getter isn't as important as providing access. ;) | |
| Jan 8, 2016 at 17:21 | comment | added | wondra | Or forget about Java getters and write a C# property instead: public int Score { get { return _score; } } and access it more comfortably int score = sceneScript.Score; | |
| Jan 8, 2016 at 16:20 | comment | added | Draco18s no longer trusts SE | @GuntherFox Good point! I didn't even think about that. | |
| Jan 8, 2016 at 16:20 | history | edited | Draco18s no longer trusts SE | CC BY-SA 3.0 | added 61 characters in body |
| Jan 8, 2016 at 16:19 | comment | added | Foggzie | You might want to include a quick implementation of GetScore(). If the public/private paradigm isn't obvious to OP, exposing a private variable with a public function might not be either. | |
| Jan 8, 2016 at 15:56 | history | answered | Draco18s no longer trusts SE | CC BY-SA 3.0 |