Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Copying Components and Game Objects Between Multiple Instances of Unity

Discussion in 'General Discussion' started by JGameMaker92, Sep 27, 2022.

Thread Status:
Not open for further replies.
  1. JGameMaker92

    JGameMaker92

    Joined:
    Oct 15, 2014
    Posts:
    85
    There needs to be a way to copy components and game objects from one instance of Unity into another. The “Select Dependencies and Export Package” method is a lousy way of doing things. It should be as simple as pushing copy and then paste. Don’t tell me any other reason why this shouldn’t be a thing. It should also be done without any missing scripts! I also want to be able to drag it gracefully from one open editor of Unity into another without any problems.
     
  2. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,337
    What is unity supposed to do in situation when you're copying an object that relies on scripts that are not present in the target unity instance?
     
    MadeFromPolygons, spiney199 and Ryiah like this.
  3. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,905
    You heard him. Without any problems.

    Now, you might assume "just copy all the dependencies." Then you wonder, what if those things already exist in the target project? Or what if they exist, but with different GUID .meta files? Or what if other things with the same name exist but have different features? Or what if the copied object refers to addressables, or has Asset Path strings? Or what if the target project has a different licensing seat context? Or what if ...
     
    JoNax97, lmbarns, shikhrr and 2 others like this.
  4. neginfinity

    neginfinity

    Joined:
    Jan 27, 2013
    Posts:
    13,337
    Yeeees, and this is why I asked that question.....
     
  5. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,015
    Well put.

    If only there was an already existing manner in which to transfer assets from one project to another...

    Oh yes, that's right, it's called packages.
     
    DragonCoder likes this.
  6. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,382
    Anything's possible.... in the world of MAGIC!
     
    JoNax97 likes this.
  7. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,886
    @JGameMaker92 it seems from all recent threads popping up, that you just really need to follow some tutorials on unity. All the stuff you are asking for so far either is not well thought out at all, or already exists.

    Stop complaining about random unnecessary features and actually learn to use the engine - its much more fun that way and you actually get something done.
     
  8. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181
    lol now the other ranting thread has some context.

    You have to know at least 1% of what you are doing. You can't just push buttons and expect things to work.
     
  9. JGameMaker92

    JGameMaker92

    Joined:
    Oct 15, 2014
    Posts:
    85
    When you “Select all Dependencies” and export them as a package you usually end up getting a lot of other useless files from other assets you have imported into your project tied into it. It’s just a mess sometimes. I don’t think it’s an unreasonable feature to ask for things to be a little more smooth and streamlined when copying between Unity projects.
     
    Last edited: Sep 27, 2022
    vertexx and Jmonroe like this.
  10. BIGTIMEMASTER

    BIGTIMEMASTER

    Joined:
    Jun 1, 2017
    Posts:
    5,181

    You have to write your code in such a way that useless things are not dependent on each other.
     
  11. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    6,015
    Lol what. 'Dependencies', you know, means something that something else is dependant on. They're not useless.

    Once again it feels like your projects need an organisational overhaul.
     
  12. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,185
    Based off of his feedback from the other thread I'm inclined to believe it's much more severe than we're thinking and that he may need to just start over with most if not all of his code. It feels very much like he's trying to build Dwarf Fortress with just the knowledge he got from Roll-a-Ball.
     
    Last edited: Sep 27, 2022
  13. vertexx

    vertexx

    Joined:
    Mar 18, 2014
    Posts:
    348
    Agree! There can be many time consuming and not always accurate options to choose.
    This should be simpler. It's annoying to be ticking off things that are obviously not connected in any way to the prefab I'm trying to save. Things like Camera options/Fullscreen etc or even character controllers (!) or skyboxes or other prefabs or assets not even vaguely associated with the prefab. Fair enough that you have a choice but it's not a helpful method or an intuitive one in any way.
     
    JGameMaker92 likes this.
  14. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,002
    You are doing it wrong.
    - Select the prefab in your project and choose "Select Dependencies"
    - that will select all the actual files required
    - with those selected, right-click and select "Export Package"
    - in the export window DESELECT "include dependencies"
    upload_2022-9-30_1-7-43.png

    That will create a package with minimum requires to run the prefab.

    This method works. If it doesn't work, the problem is your architecture. Or a really messy project. You will need to clean stuff up, and as others pointed out, spend more time learning the proper way to do things. Moving stuff between project is very simple, as long as you doing things correctly.
     
  15. JGameMaker92

    JGameMaker92

    Joined:
    Oct 15, 2014
    Posts:
    85
    “Include Dependencies” is a mess, I know it has been indicated in many other threads too. A lot of the times it’s very easy to miss certain scripts, or get too many junk files from other assets. Ya’ll are acting like you’ve never had a missing file reference in your projects before lol. But yeah it can cause the Prefab Editor to not agree with you on just about anything and you try to save your Prefab and it’ll just simply tell you that you cannot save it.
    https://forum.unity.com/threads/whats-the-matter-with-your-prefab-editor.1339745/
     
    Last edited: Sep 30, 2022
    SmithySFC likes this.
  16. lmbarns

    lmbarns

    Joined:
    Jul 14, 2011
    Posts:
    1,628
    I usually make a new folder, move the assets I want to export to that folder, then export that folder. Now in the project I import it into, everything is in that folder and I can move it to the proper place while not having a nest of crap everywhere.
     
  17. Ryiah

    Ryiah

    Joined:
    Oct 11, 2012
    Posts:
    20,185
    You say that but then you only link to your own thread...
     
  18. zombiegorilla

    zombiegorilla

    Moderator

    Joined:
    May 8, 2012
    Posts:
    9,002
    It's not "a mess", you just don't understand what you are doing or your project is a mess. That other thread was closed because it was largely nonsense.
    Closing this one too.
    Before starting any new threads in the wrong places, go the Learn section of the Unity site and start going through the tutorials. Doing things wrong and then complaining the tool is no way to get a game built
    https://unity.com/learn
     
    Antypodish likes this.
Thread Status:
Not open for further replies.