Created
June 4, 2018 16:33
-
-
Save todorok1/49f37088e3a030202b574b1b8d9b103e to your computer and use it in GitHub Desktop.
AddComponentMenuを使ってスクリプトを整理する
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; | |
[AddComponentMenu("ExplorersLab/ObjectMover")] | |
public class ObjectMover : MonoBehaviour { | |
bool isMoved; | |
Vector3 force = new Vector3(10f, 10f, 0f); | |
void Start(){ | |
} | |
void FixedUpdate(){ | |
if (Time.frameCount < 10){ | |
return; | |
} | |
if (!isMoved){ | |
gameObject.GetComponent<Rigidbody>().AddForce(force, ForceMode.Impulse); | |
isMoved = true; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment