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

How to create items from within a vehicle in real-time in Unity?

Discussion in 'World Building' started by jnt_27, Jun 21, 2020.

  1. jnt_27

    jnt_27

    Joined:
    Jun 18, 2020
    Posts:
    5
    Hello,

    I am making an FPS game. I want to be able to get into vehicles and then construct items from within the vehicle on demand and in-game. Picture a pilot that gets into a tank and then while inside the tank he can create walls, ammo/repair packs, weapons etc in the heat of battle.

    However, I have no idea what scritps/etc I should use for this. Can someone point me in the right direction?
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,851
    What you're asking is a huge and underspecified task, made up of many smaller tasks. And, for example, the fact that you are in a vehicle when you do it is pretty much completely irrelevant.

    This makes me think maybe you're new to Unity, or game dev in general, in which case you should put this one on the back burner and focus on leveling up your skills.

    If not, then maybe break it down a bit more and ask a more specific question. You will need to work out the UI (using mouse, or touch, or gamepad, or VR controllers, or hand gestures — whatever is appropriate for your currently-unspecified platform), and figure out exactly what sort of objects you want to create (walls are very different from ammo packs), whether that is just instantiating prefabs or needs some sort of dynamic mesh generation, etc. Pick one of those that you don't know how to do, and ask about that specifically, with enough detail that someone might be able to help you.
     
  3. jnt_27

    jnt_27

    Joined:
    Jun 18, 2020
    Posts:
    5
    Hello, thanks for the response.

    Yes, I'm brand new to unity and C# in general (4 days). I just want to see what it is I need to do, which you've been helpful with.

    I suppose I'm thinking specifically about some sort of HUD based building mechanic like in Battlezone 98, but I'm afraid I can't give you any more details as I know next to nothing about how I would achieve it.

    See below image for what I'm talking about, except a building is built into the targeting reticle.
     

    Attached Files:

    • bz.png
      bz.png
      File size:
      426.4 KB
      Views:
      287
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,851
    OK, then you'll probably need to learn about Canvas UI, and instantiating objects at runtime.

    But my advice is still to put this on the back burner and spend a few months working your way through tutorials and making simpler games. Then when you come back to this, you'll be much better equipped to break it down and ask the right questions.
     
    JoNax97 likes this.