Skip to content

Instantly share code, notes, and snippets.

@jonstvns
Created February 20, 2014 14:56
Show Gist options
  • Save jonstvns/9115471 to your computer and use it in GitHub Desktop.
Save jonstvns/9115471 to your computer and use it in GitHub Desktop.
using UnityEngine;
public class CachedMB : MonoBehaviour
{
Transform _transform;
public Transform transform
{
get { return _transform ?? (_transform = base.transform); }
}
//for testing
public Transform uncachedTransform
{
get { return base.transform; }
}
Rigidbody _rigidbody;
public Rigidbody rigidbody
{
get { return _rigidbody ?? (_rigidbody = base.rigidbody); }
}
Camera _camera;
public Camera camera
{
get { return _camera ?? (_camera = base.camera); }
}
Light _light;
public Light light
{
get { return _light ?? (_light = base.light); }
}
private Animation _animation;
public Animation animation
{
get { return _animation ?? (_animation = base.animation); }
}
private ConstantForce _constantForce;
public ConstantForce constantForce
{
get { return _constantForce ?? (_constantForce = base.constantForce); }
}
private Renderer _renderer;
public Renderer renderer
{
get { return _renderer ?? (_renderer = base.renderer); }
}
private AudioSource _audio;
public AudioSource audio
{
get { return _audio ?? (_audio = base.audio); }
}
private GUIText _guiText;
public GUIText guiText
{
get { return _guiText ?? (_guiText = base.guiText); }
}
private GUITexture _guiTexture;
public GUITexture guiTexture
{
get { return _guiTexture ?? (_guiTexture = base.guiTexture); }
}
private NetworkView _networkView;
public NetworkView networkView
{
get { return _networkView ?? (_networkView = base.networkView); }
}
private Collider _collider;
public Collider collider
{
get { return _collider ?? (_collider = base.collider); }
}
private HingeJoint _hingeJoint;
public HingeJoint hingeJoint
{
get { return _hingeJoint ?? (_hingeJoint = base.hingeJoint); }
}
private ParticleEmitter _particleEmitter;
public ParticleEmitter particleEmitter
{
get { return _particleEmitter ?? (_particleEmitter = base.particleEmitter); }
}
private ParticleSystem _particleSystem;
public ParticleSystem particleSystem
{
get { return _particleSystem ?? (_particleSystem = base.particleSystem); }
}
private GameObject _gameObject;
public GameObject gameObject
{
get { return _gameObject ?? (_gameObject = base.gameObject); }
}
private string _tag;
public string tag
{
get { return _tag ?? (_tag = base.tag); }
set { _tag = value; base.tag = value; }
}
private string _name;
public string name
{
get { return _name ?? (_name = base.name); }
set { _tag = value; base.tag = value; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment