Search Unity

Globalize FPS assets in a project? [Solved]

Discussion in 'Getting Started' started by kgb70, Jan 20, 2020.

  1. kgb70

    kgb70

    Joined:
    Apr 23, 2015
    Posts:
    3
    Hi all, newbie here,

    I have a scene that I downloaded that has great movement/camera/FPS scripts, just what I need. It works terrific in the sample scene the author provided. However, I'd like to use those scripts/camera/etc. in a new scene. To test this out, I downloaded and imported the free Office Snaps assets into my project. It includes a sample scene with rooms, desks, etc., perfect for play-testing. However, when I "run" that new scene, it says there's no camera and basically sits there. Makes sense; I see the scene has no camera nor anything else in it. I'm thinking I need to at least copy in the contents of the first scene (the original one with the camera/scripts/etc. for viewing and movement) into this new scene. But that seems a bit redundant. After all, if I end up with 12 scenes, there'd be 12 identical copies of the assets in each scene. Not to mention the nightmare of synchronizing the scripts if I changed anything. Is there some way to make the movement/camera/scripts aspects global to the entire project, for use in all scenes I might create?

    Apologies if this is a stupid/remedial question, but I guess this is the place to identify as an idiot.

    Thanks!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    No, there won't be 12 identical copies of the assets in each scene. Assets don't live in the scene at all; they live in your project. A scene is just a bunch of references to assets in your project.

    So go ahead and use those assets in as many scenes as you like. It does not matter.
     
  3. kgb70

    kgb70

    Joined:
    Apr 23, 2015
    Posts:
    3
    Thanks, Joe - appreciate the info. However, although the assets are indeed in my project, they don't seem to work in my new scene. They're local to that scene. So, you're saying I should just copy the relevant files out of the first scene into other scenes as needed so they work similarly?
     
  4. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    There's no "files" to be copied between scenes. But how you're implement the asset you're working with will depend on what that asset needs. Usually you'll find instructions with the asset to tell you how to implement it yourself in your own scene. But yet, worst case you can look at the sample scene and duplicate whatever makes the magic happen from that scene into your new scene. Also assets often have ready made prefabs you can just drop into a scene. Depends on how the asset is implemented.
     
    JoeStrout likes this.
  5. kgb70

    kgb70

    Joined:
    Apr 23, 2015
    Posts:
    3
    Thanks Joe. Actually, copying the first person controller from the one scene to other seems to have fixed the problem. I'm surprised there's no provision for typing object or routines as "global" so they apply to all scenes. That would prevent having to have duplicate files in scenes. But hey, it is what is! Thanks guys.
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I still don't think it's quite sunk in — you're not duplicating any files. Scenes don't contain files; they contain references to files that live in the project.

    And if you have some complex arrangement of these references, there is a way to make that into a prefab which can be shared among multiple scenes (by, of course, turning that arrangement into a file that can be referenced from scenes). So you don't actually have to duplicate those, either.