Skip to content

Instantly share code, notes, and snippets.

@fum1h1ro
Last active August 29, 2015 13:56
Show Gist options
  • Save fum1h1ro/9223212 to your computer and use it in GitHub Desktop.
Save fum1h1ro/9223212 to your computer and use it in GitHub Desktop.
_ground_obj as GameObject = null
_ground as Ground = null
ground_obj:
get:
_ground_obj = GameObject.Find('Ground') if _ground_obj == null
return _ground_obj
ground:
get:
_ground = ground_obj.GetComponent[of Ground]() if _ground == null
return _ground
class Accessor[of T(MonoBehaviour)]:
_name as string
_obj as GameObject = null
_mono as T = null as T
public def constructor(name as string):
_name = name
public obj:
get:
_obj = GameObject.Find(_name) if _obj == null
return _obj
public mono:
get:
_mono = obj.GetComponent[of T]() if _mono == null
return _mono
class Thief(OreMonoBehaviour):
ground = Accessor[of Ground]('Ground')
@fum1h1ro
Copy link
Author

ポカミス修正

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment