Skip to content

Instantly share code, notes, and snippets.

@todorok1
Created June 4, 2018 16:33
Show Gist options
  • Save todorok1/49f37088e3a030202b574b1b8d9b103e to your computer and use it in GitHub Desktop.
Save todorok1/49f37088e3a030202b574b1b8d9b103e to your computer and use it in GitHub Desktop.
AddComponentMenuを使ってスクリプトを整理する
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