I’m making my first game and I was wondering if I have to create an specific image for each platform on the game or have one base “texture” and place it multiple times. For example in Mario, each platform repeats the same brick or rock sprite. So either every platform had it’s own image or the same image is called multiple times.
If I place the same sprite multiple times in Unity, I create a gameobject with just a sprite Renderer and transform, but having multiple gameobjects affects performance, right?.
What should I do?
(Also, if I wrote something wrong please correct my English. It isn’t my native language)
You can use prefabs, but that’s very inefficient for anything more than very small levels. You should create or buy a tilemap system.
Hi, first off good luck with your first game. It won’t be easy but don’t give up. It has taken me three projects to finally get one finished but it is worth the effort when you do.
I would add a unity cube object to your scene. Stretch it to your desired dimensions, one very big one for the floor and several smaller ones for the platforms. Then apply you texture to the cubes(play with the tiling options in the Inspector window until it looks right, you will need more than one Material if you want different tiling on the different cubes. Look up “Materials” if you do not know what I mean). Do not worry about performance at this stage in your learning process. Have fun getting the basics working first, optimization is a whole lot harder with a ton of stuff to learn about, so forget about it until you are more experienced.
Next look up info about creating 2D games in Unity. There is a load of stuff on the forums and in the Unity docs about this(Google always brings up good links to the desired sections of these if you start your search with "Unity " followed by what you want to know). You will find it much easier to work with 3D blocks(with your textures applied to them) rather than getting into sprites at this stage of your learning.
Set your camera to “Orthographic” if you want a truly 2D Mario look to your game.
Look up “constraints” for keeping things moving in two dimensions(x and y) and not allowing z movement. Unity has recently added a lot of 2D stuff, inc 2D physics etc(I’ve not yet looked at these as everything I’ve made has been in 3D so far, you should have a good read up on these though)
Read through the Unity docs, forums and the Q and A sections until things start to sink in, they are all immensely useful and you will find almost every aspect you could ever need to know about covered somewhere within them.
Good luck and have fun!!!