Last active
August 29, 2015 14:23
-
-
Save tsubaki/32b120d73c0777387492 to your computer and use it in GitHub Desktop.
コンポーネントをエディタ側で取得してしまう
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
[RequireComponent(typeof(Rigidbody))] | |
[RequireComponent(typeof(SphereCollider))] | |
public class GetRigidbody : MonoBehaviour { | |
[SerializeField] | |
protected Rigidbody rigidbody = null; | |
[SerializeField] | |
protected Transform transform = null; | |
[SerializeField] | |
protected Collider collider = null; | |
[SerializeField] | |
protected Renderer renderer = null; | |
// Use this for initialization | |
void Reset () { | |
rigidbody = GetComponent<Rigidbody>(); | |
transform = GetComponent<Transform>(); | |
collider = GetComponent<Collider>(); | |
renderer = GetComponent<Renderer>(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment