Search Unity

Programming a simple 2D grid + basic vertice

Discussion in 'Getting Started' started by farmer12, Nov 20, 2018.

  1. farmer12

    farmer12

    Joined:
    Nov 20, 2018
    Posts:
    3
    Coming from C# and XNA, I am intrigued by the cross platform capabilities of Unity. I am very new to Unity though, so I need to learn lots. Like to start by programming a simple 2D grid (c#) and as a 2nd step create a basic triangle. Can someone help? THANKS!
     
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    Those are not basic steps in Unity. Basic in Unity means using either the built-in primitives (cube, sphere, cylinder, etc.), or a 3D model probably created in some other editor like Blender. You plop that into a scene and you can, if you wish/need, write code to move it around, animate it, make it react to control inputs, etc.

    What you're talking about is procedural mesh generation, and while you certainly can do it in Unity, most games have no need to, and it's an advanced topic.

    I recommend you spend a week or two going through the tutorials, otherwise you will waste a lot of time with these sorts of false assumptions that you don't even realize you're making.
     
  3. farmer12

    farmer12

    Joined:
    Nov 20, 2018
    Posts:
    3
    Thanks JoeStrout! I have already started on the tutorials and now I know why I could not find a simple way to do this ;-). Would you mind in getting me some short tips on how to get this done ?
    THANKS!!!
     
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    1. Make a model of a triangle in Blender.
    2. Export this model to FBX, and put the file somewhere under Assets in your Unity project.
    3. In Unity, drag the triangle model to the scene.

    The procedure for a grid is similar.
     
    Bill_Martini likes this.
  5. farmer12

    farmer12

    Joined:
    Nov 20, 2018
    Posts:
    3
    Thanks, I will "play" with that but is certainly not the approach I was hoping for. Since the triangle will become thousands of triangle forming a polygon with different sizes etc., I would really like to do this without any model. Same issue for the grid.
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I still think it would be faster for you to learn to walk before you run, than to try to start right off with running.

    But if you insist, check out this tutorial.
     
    Bill_Martini likes this.
  7. Bill_Martini

    Bill_Martini

    Joined:
    Apr 19, 2016
    Posts:
    445
    When I first started using Unity, I had been programming and making games for years. I had my own style and was very comfortable in that place. My first experience with Unity left me bewildered and pissed off. Unity didn't allow me to continue doing what I was use to doing. And of course I dropped it. I had never used C# before, but I have programmed in several other languages. Unity's editor was a bit overwhelming and I had a hard time understanding Unity's work flow. I came to Unity with a boatload of preconceived notions and expectations and I failed miserably.

    Later on I picked it up again and this time I decided to start following the tutorials. I got a tremendous insight into how Unity works and how to properly use it, but I still struggled. I finally actually created a project along with the tutorial. What a difference! I made tons of mistakes, typos, misspellings, missed lines of code, not applying components to an objects and not assigning objects to fields in a script. Back then I didn't know why I had problems, but I could go back over the tutorials and find why and where I made my mistakes. It taught me to use the Editor, C#, and most importantly how to debug a Unity project. I also discovered many tips and tricks in those tutorials that I've found invaluable and I don't know where else I would have discovered them on my own.

    My recommendation is go through the tuts, even if it feels like 3rd grade all over again. Keep doing until you fell you have what it takes to start your project, and then do a couple more. Kind of wished someone would have told me this when I first started, but then again I never asked...