Created
March 19, 2017 16:02
-
-
Save sukedon/ea472930b41fcdcf983ec42e65bfc571 to your computer and use it in GitHub Desktop.
Resetの使い方例
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
[RequireComponent(typeof(Rigidbody))] | |
[RequireComponent(typeof(BoxCollider))] | |
public class TriggerEnabledBoxCollider : MonoBehaviour { | |
#region MonoBehaviour | |
void Reset() | |
{ | |
var colllider = this.GetComponent<Collider>(); | |
if (colllider) | |
{ | |
colllider.isTrigger = true; | |
} | |
var rigidbody = this.GetComponent<Rigidbody>(); | |
if (rigidbody) | |
{ | |
rigidbody.useGravity = false; | |
} | |
} | |
#endregion | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment