SFE_prefabCloner.js 564 B

123456789101112131415161718192021222324
  1. //The point of this script is to generate a prefab.
  2. var createThis:GameObject;
  3. var detachToWorld:boolean=true;
  4. function Start () {
  5. var justCreated:GameObject=Instantiate(createThis, transform.position, transform.rotation); //create the prefab
  6. if (detachToWorld==false) justCreated.transform.parent=transform;
  7. }
  8. function Update () {
  9. }
  10. function OnDrawGizmosSelected () {
  11. Gizmos.color = Color (1,1,1,.5);
  12. Gizmos.DrawSphere (transform.position, 0.3);
  13. }
  14. function OnDrawGizmos () {
  15. Gizmos.color = Color (1,1,1,.1);
  16. Gizmos.DrawSphere (transform.position, 0.3);
  17. }