I am making a castle wall and right now I am using a square for the wall and 3 capsules for the "empty" spaces. Because they're the same color as the background. Is this a proper way of approaching this or should I use UI images, make them transparent at those spots and put box colliders around them? For me it's easier and faster with the sprites but maybe it is more efficient with images.
enter image description here
Wall is a square on layer 0, capsule is on layer 1 and the square representing the ground is on layer 2 so it can hide the last part of the cylinder. Is there some more efficient way you could recommend me to use? Thank you.
UIImage is a UI element that exists on a Canvas. UIImage is best used as a part of the user interface (UI), e.g. Buttons, overlays and so on.
In your case, the castle is an object in the game world, so it is better to use Sprite Renderer, as the other objects in the game will probably exist in the game space, not UI space, as well.
Related
I'm trying to rip the among us textures into Unity, but I'm having trouble with the spritesheet for crewmate animations like walking, venting, idle, etc.
Here's the spritesheet I'm talking about: https://github.com/Overload02/among-us-assets/blob/main/Players/Player-sharedassets0.assets-55.png
You can see it is not consistent at all, making a uniform square or rectangle cut impossible.
What I tried originally is just creating all the boxes manually, but this looks terrible.
How does one handle this elagently?
Maybe you could use each sprite as a seperate image instead of a spritesheet. then you could edit the edges of each one seperately.
I want to use these cubes in my own game but I have literally no idea how he got them. Look at the cubes with the black outline, the walls the ground the roof, how do I get a cube with the outline like that. I know this is a stupid question but I have tried but I cant find out why.
Thanks in advance!
Those are not individual cubes.
Take as example one of the walls, probably it's a single cube (rectangular prism) for each wall, the trick is that it has a material with a texture applied to it and a normal map.
In simple words:
A texture is an image containing the colors the object has. In this case the blue color of the walls and the black lines simulating cubes.
A normal map is something like an image but it contains information about the "depth" of each pixel in the image. In this case it indicates that the black lines should be "deeper" than the rest of the image.
A material is the object that combines the texture with the normal map and along with other settings can tell the computer how exactly it should look like.
Of course this is only a very brief definition, if you want to know more about it I recommend you to read about: Materials, textures and shaders in Unity. There are some tutorials in Unity web page.
Use photoshop to create a single tile of each type of block and use it.
I'm looking for ways to clip an entire unity scene to a set of 4 planes. This is for an AR game, where I want to be able to zoom into a terrain, yet still have it only take up a given amount of space on a table (i.e: not extend over the edges of the table).
Thus far I've got clipping working as I want for the terrain and a water effect:
The above shows a much larger terrain being clipped to the size of the table. The other scene objects aren't clipped, since they use unmodifed standard shaders.
Here's a pic showing the terrain clipping in the editor.
You can see the clipping planes around the visible part of the terrain, and that other objects (trees etc) are not clipped and appear off the edge of the table.
The way I've done it involves adding parameters to each shader to define the clipping planes. This means customizing every shader I want to clip, which was fine when I was considering just terrain.
While this works, I'm not sure it's a great approach for hundreds of scene objects. I would need to modify whatever shaders I'm using, and then I'd have to be setting additional shader parameters every update for every object.
Not being an expert in Unity, I'm wondering if there are other approaches that are not "per shader" based that I might investigate?
The end goal is to render a scene within the bounds of some plane.
One easy way would be to use Box Colliders as triggers on each side of your plane. You could then turn off Renderers on objects staying in the trigger with OnTriggerEnter/OnTriggerStay and turn them on with OnTriggerExit.
You can also use Bounds.Contains.
I took a sprite sheet from the Internet and began slicing it in the Unity sprite editor. It was going well, when I found a sprite that was too close to another sprite to encapsulate the whole sprite without cutting off the top of the one below it! My only non-invasive option was to modify the outline of the shape that you use to cut off individual sprites from a sprite sheet. So how do you make a polygon-shaped sprite slice? picture of my sprite sheet
As far as I am aware, there is no way to change the geometry of a sprite in Unity from a rectangular shape. I am not a rendering expert, but the increase in geometry would add unnecessary overhead to the sprite drawing process.
Your best bet is to edit the sprite sheet in an image editing program such as Photoshop or GIMP, so that all sprites fit into a grid form, or at least a form where they don't violate each other's rectangular bounds.
Try to disable polygon mode. Polygon mode will save space but isn't friendly to rectangle mode.
I am making a 2D game in Unity 3D. I have a few sprites, but they are so transparent that I can barely see them when the game is running. How can I make them more opaque?
The textures used for the sprites could be semi-transparent, the SpriteRenderer component color alpha value could be set somewhere between transparent and opaque, or the Material could have semi-transparent aspects. Try checking all 3 of these possibilities.
I have just found out that it's easier to do it with GIMP. I open the file representing the spite with GIMP. I select the parts of the sprite from witch I want to remove the transparency using the fuzzy selector (Tools->Selection->Fuzzy), I click on each of them with the right mouse button and choose Level->Tranparency-> Remove alpha channel.
That's pretty much it.