playMaker

Author Topic: [SOLVED]Duplicate GO  (Read 1777 times)

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
    • View Profile
[SOLVED]Duplicate GO
« on: May 29, 2012, 08:26:16 PM »
Ok this may be a dumb question but when i Duplicate an object how do i know what is the new one and what is the old one.. when you have an object referenced around your project and then duplicate it and manipulate it and then realize you were manipulating the wrong one you end up where i am right now... again...

Why does it not give it a new name with copy on it or something.

Q
« Last Edit: June 04, 2012, 03:49:27 AM by jeanfabre »

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
    • View Profile
Re: Duplicate GO
« Reply #1 on: June 01, 2012, 11:49:37 AM »
I got a good answer on this from the Unity Answers along with a script to make my own Duplicate command. I had to adjust it some but love it now..

Q

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14692
  • Official Playmaker Support
    • View Profile
Re: Duplicate GO
« Reply #2 on: June 04, 2012, 03:49:12 AM »
Hi,

 could you share the link to the answer? cheers,

 Bye,

 Jean

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
    • View Profile
Re: [SOLVED]Duplicate GO
« Reply #3 on: June 04, 2012, 07:46:59 AM »
Sure just trying to find the post.. I can not log into Unity Answers for some reason and i have not received any replies to my help requests. I have to use the I Forgot my Password Link every time..

http://answers.unity3d.com/questions/259675/which-go-is-the-new-one-when-i-duplicate-a-go.html

There is the link.. And here is the script i ended up making.. It is just a hack i am sure but it sure works for me.. I realized that it does not work for other things besides GO but other things already index the names. Like materials.

Its Java... As you will see in my post i did not get that right away.. ???

Code: [Select]
@MenuItem ("Edit/Dupe %#d")
static function Dupe () {
    var go = Selection.activeObject as GameObject;
    var dupeGo = Instantiate(go);
    dupeGo.name = go.name + " copy";
dupeGo.transform.parent = go.transform.parent;
dupeGo.transform.position = go.transform.position;
dupeGo.transform.rotation = go.transform.rotation;

}

@MenuItem ("Edit/Dupe %#d", true)
static function Validate () {
    return Selection.activeObject != null;
}