#๐ผ๏ธโ2d-tools
1 messages ยท Page 11 of 1
Like this
I already tried to modify the Order in layer
Must i use a canvas ? as it appear like this? I'm watching a tutorial where he don't do need this
Why ARE you using a canvas?
I follow that tutorial : https://youtu.be/EeOAme1bt7c?list=PLbsvRhEyGkKcF6TDBhEqYA6cCOjFpV0YM
Code and assets linked below. Learn how to make a 2D RPG turn-based battle system utilizing free assets and the powerful tools Unity has to offer. In this tutorial I walk through every step of the game making process. Characters have range and melee attacks, health bars and mana. This is the real deal. Linked below is a playlist of the full seri...
it's 3 y/o so maybe it's not updated to today's use
Basically, canvases are meant for UI.
I'm on mobile so not gonna watch the video. So I can't say why he chose that method.
Any good channel/tutorial maybe for updated use
For a 2d game in Unity
Again, I'm on my phone 
Not now but when you have time, feel free to give some links ๐
This tutorial doesn't instruct you to make characters from canvas images, just the UI and background
The characters are sprite renderers outside of canvas
Any ressources to learn about that?
hi did someone know how this characters are called?
like with just legs that move, i cant find any assts with this style, please help me.
i change a button's parent and suddenly it becomes invisible
i dont know how i can change it back, i literally just created an empty object to sort my hierarchy and when i move the button into it, it just disappears
even when i just bring it out of the other parent
You've got this in 2d, but is it UI?
If it's UI it isn't 2D exactly
if so try #๐ฒโui-ux
oh well i didnt know what was wrong but i deleted it and done it again and it worked
Hello, I want to replace assets in a tilemap with updated sprites but am not totally sure how to do so, any tips?
hey
Any idea whats happening with left tile? I dont even have it in the rule set
You have it as the third tile
Because your second tile's rules are wrong which should go there, it likely resolved to third one semi-randomly
Guys, has anyone here worked with 2D ragdolls? I need help with ragdoll balance
Hello everyone, I've been having a problem with Light 2D for some time now.
I work with pivot points so that the player can tell when they are behind a house, for example, and when they are not, in order to display the SpriteRenderer visually correctly. This works great, and at a certain point, the character disappears behind the house.
But now to the problem. The light stays there, of course, because it continues to illuminate the layer that was specified. My actual goal would be that as soon as the player disappears through the pivot point, the character no longer illuminates the target.
I've attached a picture, maybe someone knows the problem.
URP's 2D lighting doesn't work with isometric styles because of this issue
It's designed for fully top-down or fully side view
is there something can work with? Can you recoment something? because i want to make my Topdown 2d game wth flashlight that works behint and in front of objects correctly.
https://assetstore.unity.com/packages/tools/particles-effects/smart-lighting-2d-112535 this one seems to have isometric light directionality
And a fake shadow height too, so shadow casters aren't infinitely tall
yea i got this one, its reeeaaalyy complicated. But i think i cant get around that anymore :/
Can or can't?
It's likely your only option, but you could alter your art style to work around the issue
i need to work with that asset.
i wanted to avoid it because its a bit much. Its a good asset but for somone thats only working with unity for 1 year it can bit a bit to much.
It is easier than making your own 2d lighting system, probably. ๐
yes
No, that was the original rule tile sprite. I changed it to a different one and it got fixed.
Don't crosspost please
hey im very new to unity and ive mostly been following tutorials but i cant figure out how to not make the background follow my camera like that, it may have something to do with the cinemachine tool but idk tbh
oh damb no embed
should i upload it to yt or something?
imgur is usually fine
unless it is really big
I can't see your embed but usually people have 2d backgrounds follow the camera by just parenting it to the camera transform
Depends on what you are specifically trying to do, though
How do i make any gameobject instantiated from default tiles to save changes made to them during edit mode? I am able to instantiate gameobject using tiles in the tilemap and rotate them using "GetInstantiatedObject(position)" using my custom brush, but when i go into play mode those changes donยดt apply, if more info is needed, i can provide.
hi anyone knows how can i put this tourches in my map
in the left walls of course
Using SpriteRenderer, is there a way to make the edges move inwards? I'd like to make them flush to the fill.
Using tilemaps is kind of obvious. Is there a reason why you can't just do that?
What edges exactly? "Flush to the fill"?
Move the edges inside this line.
Since this same line is going to be matched by the polygon collider.
I need to have the ability to change the material without having the sprite shape adapting to it because the edges is a bit bigger/smaller and also expanding the collider if i do use one.
I'm a bit thrown off by the terminology here, officially
"Edges" are the extents of mesh or collider geometry
"Material" is the shader reference used for rendering sprites as in the material field there, changing it won't affect the collider or sprite outline
Do you want to change the sprite without affecting the collider?
Sorry if it was a bit confusing. ๐ต
By edges, i meant the sprite edge. Currently, it just goes along in the centre of the line.
How should it go instead?
Like this one.
There's an offset parameter that I can use.
There's an offset parameter that I can use which can move the sprite edge more inward or outwards.
Probably no such option, unless Custom Geometry Creator gives you that
A simple but a bit clumsy way would be to bake the offset into the sprite itself with empty space, and adjust sprite Physics Shape if you want the collider to not match the sprite exactly
Yeah that's about the only way I see sadly.
how would I go about adjusting the pivot point for multiple sprites in a spritesheet at once?
thanks
can you tell me how to make a change of clothes and how it will be in the animator? Unity
There's many ways to do that potentially, depending on what that means in your situation
hi im going insane why is my IK doing this when i generate the target
both the right arm and right leg are having the same issue
the thing in the screenshot you sent is a script, not a component within unity
๐
That is weird. Can you give more details about how you set it up? Are there the wrong number of transforms in the hierarchy for the type of ik you used?
Can't add anything to the image
Managed to figure it out on my own, Unity doesnt seem to like it when you stack two limbs on top of eachother when you make the IKs
Hm, not sure what you mean, but interesting!
Might be worth bug reporting.
They should be basically independent
Hi everyone, i'm doing a 2d retro Aoe2/Cossacke like rts game .
I'm struggling to find rts 2d isometric ressources freetoshare .
Can somebody help me.
I need some 16th century Sprites.
If anybody want to help in any way, feel free to ping or dm ๐ฃ
guys, i have a 2d tilemap that i expanded alot by adding tiles, and then i removed tiles from it, but it seems like the gameobject is still bigger (it didnt automatically shrink when i removed the tiles). this makes my tools' (move/rotate/etc) anchor point to be completely off, anyone know how i can reset the tilemap to only be as big as the tiles it has?
Has anybody worked with animated tilemaps before?
Tilemaps/Grids have one single anchor point, it doesnโt change depending on the tiles you add or remove.
Hi all,
After years of developing 3d projects I am developing a 2d mobile game for the first time, I want to know an artistic pipeline from concept to exporting animated 2d characters into Unity.
I was reading and watching videos for a week, and I had no clear pipeline to follow: some creating characters through painting, others in a vectorial way, some using specific animation programs, others animating into Photoshop directly...I am lost
I thought about this pipeline, but as an absolute beginner, I do not trust my no knowledge:
. Creating a concept through IA
. Create the character itself through vectors in Adobe Illustrator.
. Animate the character in Adobe Animate.
. Maybe create the sprite atlas with the animations in Texture Packer (I do not know if need this software as I do not know if Adobe Animate can do the same work)
. Export from Adobe Animate or Texture Packer to Unity.
How do you see this pipeline? It is right for a simple 2d mobile game? I have access to all the mentioned software and I can purchase another one for this project, I only care the fast and easy production, not the money
I hope you can help
Thanks
I have a 32x32 sprite sheet split into 2 sprites but for some reason i can see a bit of a pixel from the second sprite in the first sprite. any ideas?
Anything beyond "create images in an image editing program of your choice and import into unity" is optional
Post only to one relevant channel
Your sprites need empty space between them on the sheet, or "padding"
yeah the animation place seemed a little too high brow for me haha
but i got the padding thanks
Was wondering if someone could help me - When I change the localScale on my player (which controls the direction my player is moving), it like jumps, despite the pivot being in a decent place.
#๐ผ๏ธโ2d-tools was the most relevant channel I could find. Sorry if it was the wrong one
How do you know the pivot is in the right place? pivot mode is "center" here which conceals the real pivot position
I just want it to flip without it like jumping to somewhere else
And the origin point/pivot seems to be in a good place for that
I'm fairly new to Unity, so I'm not 100% with everything
The button I cropped from your video determines whether your selected gameobject's center is treated as the pivot instead of its real pivot
This means you are not seeing where the pivot really is
Start by clicking the button
ok. It's moved to its real pivot, so I now see why its jumping like that
Is there a way to center the real pivot?
Select all the child gameobjects and move them to be upon the real pivot
Now works perfectly
Thanks for your help
Ok, it works fine in scene, but not in game
nvm. My animation positions are causing it
there we are. fixed it
ive been using firealpace to make these basic sprites
my sisters won't let me borrow their ipad or drawing tablet so how can I make sprites easily
with geometric shapes and a library of textures maybe
what software
I have triangle sprite with collider. Pivot is on the bottom center.
When I place tile of the sprite into a tile palette I have an offset of half of a cell.
Then I enter the tile edit mode to set the y offset to -0.5f so the triangle fits the cell.
But a collider did not offset with its tile.
(Sorry for my English).
So put the pivot in the middle?
not the same in time and effort to animate pngs or vector, thatยดs why I ask for saving time and make it easier
100% depends on the kind of art style you want and what kind of art techniques you're familiar with
Not man, the topic is not about visuals, it is about a fast production-ready project, you can achieve almost any style with any software if you have the skills, it is a technique debate: whatยดs best for a 2d mobile game in a production way, to animate sprites or vectors, what software do you use for that if you published any game, software that enhances the unity bad points like tecturepackergui, and so on...
Your choice visual style will determine the technical implementation, and even then there is no just one perfect path forward
Unity's sprite atlas feature is completely fine, you don't need an external texture packer
Unless "2D mobile games" have all started using the same art direction you still have a lot of choices to make
If you want vector graphics, you will need to figure out if it's better to import them using the vector graphics package, or if you need to export them in a specific way into raster sprites
If they need to be animated, an art style may enable you to animate a hierarchy of transforms with each their own sprite, or it may restrict you to having to do flipbook animation
You may additionally be able to utilize 2D skinned rigs for a specific type of animation
Many different art programs can be used to produce assets for each of these workflows
It will not scale from the bottom then.
Hello guys, is there any way to save tilemap drawing as a prefab?
You can save the tilemap gameobject as a prefab, or make the drawing on your tile palette so you can reuse it when drawing
can someone explain why my sprite looks like this in unity?
oh word thanks
I'm trying to import a .PSB rig with 32x32 sprites but the imported sprites aren't 32x32 unless they're .PNGs, how could i fix this? (left .PSB import, right .PNG import)
Does it cause any issues?
yeah im trying to make them able to be easily swapped out with other sprites without causing issues later on
i've already tried doing it with the non-32x32 sprites and it didnt go well
if its a 32x32 sprite its position is predictable
try "full rect" sprite mode
sprite renderers will adjust their size when you swap the sprite reference
If you swap it in shader, it cannot adapt
Thanks for replying. You need an external tool like texturepackingui cause Unity does not receive the info on the pivot point of the texture atlas, and u have to manually set then in every frame of animations, it is a productivity killer.....Yes, u are right about the exporting method question, and that was one of the key points of the debate, and still guessing between working with sprites or vectors, as vectors are easier to animate and u do not need a lot of art skills, it is a more technicall and less artistic process...But the point is that I want to start from AI concepts to save time and gain visual appeal, so at this point I would like to try if possible to vectorize the AI images that I create, so I can animate them as vectors, while having the appearance of bit maps.....As I did not have this process before I want to know if this is a possible and productive process, trying to avoid as much of the art procedure
Normally you make animations in whatever program, then export them as a sprite sheet or image sequence so that the pivot is always in the same position relative to each sprite extents, then import, slice appropriately, and optionally use sprite atlas feature to optimize their performance
There's no point in that process where you must set the pivot manually for each sprite
What "debate" do you speak of?
The workflow you're suggesting seems a bit bizarre to me, a lot like asking how to make a burger using only microwave burgers but make it look like a tortilla
I do not know if u are a 2d artist but there is a big difference between the time employed animating in a nonanimation-specific software and a dedicated one. Unity does not keep the info on the pivot point of Adobe programs, so u have to set it manually in all frames or use an intermediate program. The debate is the topic we are talking about...Ok, I see it is bizarre for you, I do not know at what point as I never did this 3d process before, I create the images, vectorize them, animate them, and use a program to optimize and organize the animations
You can set a pivot for all slices in a sprite sheet when slicing in Unity
I would believe it's unnecessary to move the pivot when animating, when you can instead move the character relative to its sprite
what does full rect sprite mode do? i tried it and nothing seemed to change
It makes the sprite renderer draw a full sprite-size quad for rendering the sprite instead of using the sprite outline that tightly follows the sprite's outline
That it doesn't work seems to indicate that the PSB importer automatically crops them
bummer, anyway to fix that?
I don't expect so, besides not using PSB importer
It's designed to rearrange each layer as an individual sprite so it makes sense for it to crop them
Are you fully sure you need the empty space?
im pretty sure, i cant think of any other way to do it, im still very new to Unity
what pixels/inch should i use in Photoshop and how many pixels per unit in Unity
i changed the sprite the SpriteRenderer on the head was using and now its not interacting with the skeleton or the rig (you can see here how the face is still bound to the head bone but the head itself isnt)
im trying to set up a character customization/gear system but i cant get it to work with my rig
You're not using inches when making game assets
Pixels per unit is a standard set by you to keep your graphics at the same resolution relative to each other
If you need to change the sprite of a skinned sprite, you'd use the sprite library's sprite swap feature instead
thank you for saving my life sir
PPI has no effect unless you print.
thank you
thank u, it was a different setting
looks not blurry now ๐
@jaunty quarry Basically what you want to keep in mind is that the Unity camera is twice its Size tall in units, if orthographic
Those units are stretched to fit the user's screen vertically
Pixels per unit determines how many texture pixels a sprite will have per unit as a sprite renderer by default unless scaled
Can shadow casters be opened shapes? Because now its making shadow problems like this.
What do you mean by "opened shape"
so it can be a rectangle with a line
this is closed shape
I assume not
2D URP's lighting can't really do isometric lighting of much any kind
guys, how i resolve this? when I change resolution from 1920x1080 to a resolution of a cellphone all the sprites and fonts of texts become pixelated
Likely because your Game window has to zoom out to fit the resolution, as Game window's zoom doesn't use any fancy resampling algorithm
It likely will not appear like that when built
can u slice a sprite sheet like how u can with a single sprite? so when u make it bugger only certain parts get scaled up or how does this exactly work?
Hi! I know it's easy but I'm new to Unity: how to make the button's width fit the text inside it? Thanks
i am really getting frusterated with creating art for my game, what is the general size you guys go for Art? everything i do looks wrong and blurry to me
it sounds a bit like you're talking about "9-slicing" of sprites
can u elaborate
9-slicing is the only thing that comes to mind from your description which is rather vague
You'd look up what it is, and determine if my guess was correct at all
You'd rather ask in #๐ฒโui-ux
Unity uses mip maps rather than resampling algorithms when sprites are viewed above or below their native resolution
(unless the display resolution is one of the mip maps, meaning reached by doubling or halving the resolution when scaling the sprite object)
Additionally you'll want to be sure that the resolution you're viewing your sprites at in editor through the Game window is not weird or zoomed out/in
ok im wondering
i currently have pickups in my game as puzzle elements
only thing is that my player character is based on a rigidbody with addforce, and touching pickups slows my character's momentum
is there a trigger system i can use instead for pickups instead of colliders?
ok found the istrigger option and ontriggerenter
awesome
Hi guys, sorry for being annoying, does anyone know how I can fit these dungeon rooms into just one square?
like this
Can you be more specific? By one square you mean a grid unit, or a screen, or...? You want to delete anything outside of that area, or shrink what you have to fit?
I want to made just like the second picture i send like dungeons on square just like the photo with the walls but thats easy my issue is to make the dungeons with a format of a square and not like what i have in the 1 picture
I just want to make the dungeons walls like a room with 4 walls
Do you know the game enter the gungeon?
I want to make like that game
I do not.
Just imagine its a 2d game with squares rooms
So you just... draw square rooms?
Hopefully this is the correct channel. I don't know much about optimizing assets, and I was wondering if there's a way to cut this down from 46mb, it contains a lot of sprites so I did have to up the size, it's 4000x3040 & 46MB spritesheet, but each sprite is 160x160 as the original canvas size from aseprite was, is there a way i can cut out all the extra space without automatic slicing?
Show the sheet? Hard to randomly guess ๐
Well, it looks like you could definitely cut that down a lot. Either trim it in aseprite, or pack in unity I guess. You'll probably want to use a power of two size, to enable better compression options.
Two size?
Power of two.
Sprite atlas workflow
It automatically cuts off empty space and packs the sprites into a power of two sized texture, while preserving sprite references and pivots
For sprite atlas it doesn't matter what shape or size or how much empty space your sprite sheets originally have
hello how would i properly cut my sprite in the skin editor in unity , im trying to animate this image buts its all together and i can't
Which unity version is it?
One of them had totally broken selection functionality on all sprite editor tools
2022.3.4f1
I think that indeed is the particular one that broke
Download the newest version of that editor (2022.3.20f1) and upgrade your project to it
any link on how to upgrade my projct so i dont break anything
There are no steps to it besides download the newer editor, then switch your project's version to it through Unity Hub's project list
The third number of the version means patches, and in my experience upgrading that hasn't ever broken anything in a project (besides introducing new bugs if the new version suffers from some too)
But if you're worried you can always make a copy of the project
Or, which you should always be doing anyway, use version control software
Swapping a project to an editor with a different year number or major version number (first and middle ones) is likely to break things, on the other hand
okay i see , ty very much for your help, i will install the new version
Hi, I am implementing Perlin Noise Terrain Generation into my game and its going well.
An issue I am having is with Unity Ruleset tiles. I want single tiles to not have connecting tiles. It needs to be in a 2x2 to connect. I have a somewhat working solution however, tiles still are trying to connect to the single tiles. Is there anyway to add conditions to a rule set tile to not connect to a single tile?
A single tile is a tile that has no tiles around it
There are none in the picture
I have a hunch what you might mean but I hope you can clarify it
Spelling it out what tile exactly should not connect will help you articulate it into tile rules
I created an animation in Unity that changes the z-rotation of an object in 2D. However, the animation doesn't work in some cases, and during these times, I cannot make any changes to the z-rotation. How can I fix this issue?
This is kinda vague as to what your actual issue there is, but if you are trying to correct the rotation independently of the animation, you'll need to change it after the animator runs in Update. So you'll want to have the script work in LateUpdate. If you're trying to fix the animation not working, gonna need more information about how it doesn't work.
is there any way to get something like a sprite shape to act as a sprite mask?
Does it not seem to work the same as when using other types of sprite renderers as the sprite mask?
Depends on your version.
I believe that the most recent version should support that directly, but if not you can always hack together your own masking with shaders.
i have a skeleton rig with hinge joints with angle limits meant for ragdolling, but the problem is if i rotate the bone, the hinge joints and the angle limits rotate with it, any advice? i want to be able to use this rig for animations outside ragdolling
you can drag any sprite into this field and the sprite mask will have the same shape as the sprite you put in
I was asking in regards to a sprite shape since I need to be able to change the shape easily at runtime to align with a polygon collider
2022.3
Hi everyone - stupidly embarrassing question, but I'm a Unity beginner! I'm just building a flappy bird clone just to practice on something, but can't understand why my main orthographic camera keeps pixellating my bird asset in the game window. I think I'm fundamentally just not understanding something about cameras, but can't seem to fix it.
Main Camera Setting look like this:
Your game window is set to emulate a screen that's 10 pixels by 16 pixels
Much smaller than phone screens these days
Ahh, nevermind - solved it! @modest cargo yup, my issue was that in creating a new display resolution, I selected "Fixed Resolution" rather than "Aspect Ratio". ๐คฆโโ๏ธ๐คฆโโ๏ธ
how would one accomplish that?
Would this be the right place to ask a Q about ShadowCaster2D & sprites?
Is there a way to disable shadows from casting on a particular sprite if the ShadowCaster is enabled in a scene?
Maybe change material to Sprite Unlit Default?
i'll try that
yeah, that worked cool
Hi! I don't know if it's a good place to ask, but is this a good way of adding leaves to the tree?
Aren't those leaves right there?
Yes. But I don't know if adding each leaf "clump" as an individual object is efficient.
Efficiency depends on the components they have, and how many of them you'll need
If you can get by with just one sprite of all the leaves that'd be better
The actual sprite geometry will be batched, so most of the performance difference will be due to overdraw.
This is not really the place for asking for free work or for sharing pet pictures
!collab
We do not accept job or collab posts on discord.
Please use the forums:
โข Commercial Job Seeking
โข Commercial Job Offering
โข Non Commercial Collaboration
Okay
I want to set up an arcing lightning graphic which would have to be longer or shorter based on the distance between the targets, is there an easy way to do this?
Line renderer component
๐ thanks
anyone have advice for tilemap tile coloring? I have so far had 0 issues (besides this one now) with runtime based coloring on tilemaps. But for some reason this loop (pic 1) which I know is being called and is even (with the help of the debugs) actually changing the color of the tile. But for some reason isn't actually changing the color in the game itself (or the change isn't be reflected despite it happening?). I have done the same system elsewhere and it works so I am seeking advice as to why it wouldn't work now lol.
I figured it out
Hey, is there a tool to cut spritesheet into sprites in a different order?
Instead of left to right then top to bottom I need top to bottom then left to right.
Normal spritesheet:
[1][2][3][4][5]
[6][7][8][9][10]
My spritesheet:
[1][3][5][7][9]
[2][4][6][8][10]
First I'd ask why does the order matter in your case?
Hello,
I created an open Spriteshape and attached a child object into it. When I modify the spriteshape, it correctly creates its pivot in the center, but the child position is unchanged and stays at global position 0,0,0 and does not respond to changes in the spriteshape. I would like the child object to always move to the new center position of the spriteshape. How to achieve this? Thank you! ๐
The picture below shows the case when the circle is a child of the spriteshape and has the position 0,0,0
Are you sure the pivot is changing? If your transform tool is in Center mode rather than Pivot the gizmo would appear at the dynamic center rather than the true pivot
First of all, thank you very much for response and help ๐ Yeah, you are right.... true pivot is in 0,0,0. ๐คฆโโ๏ธ
@modest cargo Do you have any experiences with spriteshape? It is even possible to set desired pivot to spriteshape? I found some old topic, but without solution: https://forum.unity.com/threads/is-there-a-way-to-set-a-pivot-on-a-sprite-shape.1066343/
Yes its an animation, but by default all tools I found cut sprites by the first order(same for Unity) so I need to convert 2nd layout into 1st
and doing it manually is a pain
Pivot in unity is the "sprite's position relative to its transform position" which I'd imagine is not necessary to set for a sprite shape because you always know where it will be
The forum post's mention of "pivot moving unpredictably" is a bit confusing to me, as if they were mistaking gameobject center for the pivot likewise
But that doesn't alter the sorting
If both tools and unity use both the first order, is there an issue?
If you need to change the order arbitrarily I guess you could use Unity's Image Sequencer included here
https://github.com/Unity-Technologies/VFXToolbox
It's flexible for many tasks
I have two cases I would like to achieve:
The first is the case where I have a straight platform (from two points, not curved) and I want to place a sprite object in the center of it.
The second case is another straight platform, where I want to position pivot on platform to rotate the platform around that point. Because now I have to create spriteshape so that it intersects the default point 0,0,0 in the position where I want the platform to rotate.
In the first case the sprite has to remain at the dynamic center of the sprite shape even if it changes shape?
In my game I am using spriteshape to create basic platforms that consist of only two points and are not rounded in any way. I want to mark one type of gaming platform with a sprite with a lock, which will be always positioned in center of platform. Of course, I could place the child with the lock manually, but it would be more ideal and accurate if it was done automatically as in "default".
If you want it done automatically you'll need a script that gets the average position of the shape (from points or bounds) and sets the object there
@modest cargo kk, I will do that, thank you for everything! ๐ have a nice day ๐
I just need a tool to cut them up in 2nd order so I can then use those files(in correct order) to create proper spritesheet that Unity can understand.
If the Image Sequencer doesn't do what you need well enough, Aseprite has the option to import and export sprite sheets in any configuration
Thanks I will try that
You can also just rotate the sprite sheet 90 degrees, cut it out, then rotate the other way
then reassemble the way you need ๐
how do i check when a player walks on a certain tilemap with a certain tag without using box colliders?
the tilemaps are animated and have physics outline in their sprite editors, composite colliders, rigidbody, tilemap 2d collider, etc, but they won't respond to oncollisionenter2D in my lpayer
The tilemap collider should work
idk if this is related, but i dont see the collision show around the tilemap when i place it like my other collision tilemaps have the collision visible in the editor but the animated water doesnt
but i configured everything the same for both of them
so maybe it has something to do with the fact this one is animated
Hi im having a problem on my sprite renderer, its like off the grid and scaled down.
We're looking at the sprite editor here, not the sprite renderer
The problem is not apparent
Other than being a kinda inefficient texture layout.
Could someone pls tell me how to fix this problem in unity, where 2d sprite look ugly (not blury) and break on movement, with default camera?
Don't crosspost
Oh yeah, i meant sprite editor
Because it is actually opaque?
i have a problem rn
im trying to rotate a character rig that has bones, IKs and HingeJoint2Ds for ragdolling, but whenever i try to flip the character by setting my parent objects X to -1 my HingeJoint2D angle limits also get flipped
only way i've come across to fix this is by transforming my hip bone's (the root bone of my rig) Y axis to -1 but this messes up the IKs on my parent object and they dont line up with the rest of the rig
(the IK is not supposed to be there)
lol ok to anyone had this issue I just had to change collider type to sprite in each animation tile thingy
I have a mechnic that lets you build gameobects via Drag-Release, Similar to Factorio. Im using a 2D Grid but im concerned about how accurate things are, especially when interacting with other game objects.
Should i be using a Tilemap system for the building instead of Grid based?
i think i have to right? especially if im building like a wall il need to have Auto Tiling
Instead of scaling have you tried rotating it?
Yeah, actually makes the issue worse because it offsets the anchors too
In that case, having a parent object to handle rotation and scale might be a good idea.
Or do what I do and render the entire rigged sprite hierarchy to a render texture and just put that on a quad that can be scaled and rotated.
(Which is usually not worth the trouble, but sometimes it is)
Itโs all being rotated by the parent object already, but maybe thereโs a better way to handle it
Hey, how can I fix this?
As you can see, the trunk is being placed on top of the leaves of the bellow tree.
Changing the pivot of the sprite does help a little bit, but then the tree isnt positioned properly on the tile
And it won't help much, as you can see
Oh, I fixed.
How can i avoid this in sprite editor?
What's the "this" you're trying to avoid
Settings button is cut to 9 parts
I alrrady separate icons from other stuff to avoid this
Avoid using automatic slicing, it's extremely rarely the best option
Instead slice by grid size or count or completely manually
Thats what i did, still thx for advice
i havent worked with 2d sprite sheets much, i have this sheet where there are different tiles on it to animate the water moving for each directional/type block. what's the right/easy way to work with this? usually with character animations id highlight the frames and drag into the scene to create the animation, but that seems like a pain here with a tileset
Have you looked at the animated tile extension for tilemap?
Question, do anyone happen to have good enough knowledge to know how to mess with the Drawing gizmos. I want to customize them to be more suitable for my isometric game. I want to contort the blue square to something like red
Hey there guys i've download this tileset https://maaot.itch.io/mossy-cavern and i've some troubles setting it up. Do you have any good tutorial so set it up?
Depending on what version of Unity you are using you might want to use handle drawers instead. They have built in functions to do that kind of rotation.
If you are trying to use it just for highlighting you can use a ReactnagleHandleCap with any handle you might need.
Handles are like Gizmos that can mess with a game objects data directly.
Example the Transform tool for moving, rotating, and scaling an object is an Transform Handle.
Ok interesting. I'll have to take a look when I get home and see what you are talking about. Thanks for the tips.
Just to give you some help in looking for the documentation. Here is a link to the Handles API.
Due note if you see things like handles and handles cap the easiest way to think about it is as following.
Caps are meant to allows drawing a visualization and choosing an editor event to update it on.
Based on the editor event you choose to update it on they do something different with the value they return.
Handles actually allow for returning data and editing variables. Example I use Handle.DrawArc to made a visual Line of sight detection system that I can see and debug in my 2D metroidvania project for AI. I can drag the handle out to increase the float value in AI Sight code for distance to check.
Depending on what you want you could honestly get away with the simple Handles.DrawOutline function.
It draws an outline on whatever gameobject, sprite, or anything you want it to.
https://docs.unity3d.com/2023.2/Documentation/ScriptReference/Handles.html
Awesome thank you so much for the example. I'm just trying to represent in the editor what region of tiles will be grabbed by different objects (the flag in my example picture) without having to load up the game
So to just clarify by grab are you meaning you have a custom data handle that makes interacting with the object grab tile data or do you mean literally grabbing and moving the tiles.
Depending on the answer Unity actually might have what you are looking for built in.
Fair question of my wording lol. No the flag is an object just a range number for how many tiles out it searches from its position to add to its own list of "objectiveTiles". And in game right now they get colored like purple. But that requires me to run the game so I was hoping to just get a bounding box to show it in editor instead since it'll be easier
Ah okay so good news if you have logic to already get the tiles depending on what version of Unity you are using there is a Handles function that let's you pass in different size data. This can even be from sprites and tiles.
The Handles.DrawOutline function has an overload call for the method that lets you pass in an array of renderers.
You can actually just pass in the list of renderers from your tiles and that is all you need to do.
You can control the color by passing in a color into the method call for the outline.
If you want more than an outline and you want a box fill that is transparent you can do that as well.
https://docs.unity3d.com/2023.2/Documentation/ScriptReference/Handles.DrawOutline.html
Omg that is amazing. Me in 2 hours when I'm out of work will be so happy
Glad that might be able to help you.
If you need help with an example script I think I can dive into my code and copy out an example for you or write one from scratch to match which version of unity you are using.
I say version of Unity because the Sprite Dataprovider tool set got some new ways recently to grab the sprite outlines into a single renderer.
Using that function to grab individual tiles and make an outline from their combined render.
I use the Handles.DrawOutline for debugging stuff in my game.
If you want to message me I'll happily accept it. But I'll mess around with it all when I get my next chance
I can make an example after I finish my lunch meeting with different ways to doing it.
Will share some screen shots as well for visualization.
it looks as though my version of unity doesn't seem to have DrawOutline lol
Which version of unity are you using?
2021.3.8f1
I can try and see if their is an easy API with handles to do that in.
If not you might have to rely on Gizmos drawing for now sadly, but that shouldn't be too hard.
would updating to a newer version add this feature lol
That is always up to people if they want to try a newer version of Unity.
I know some people are stuck on the older versions of Unity because of their project and don't want to risk and API breaking changes.
that has been me lol
if it isn' t possible ill survive, was just really hoping to have some visual aids
I can make a video in an hour. Will also download that version of Unity to make sure the API in the video matches what you can use to help.
Edit: Might try to make the examples into a GitHub repo for people to try and see. Can't promise much though on a timeline for that.
Is there any way to generate (and save to file) a Sprite Sheet during runtime?
(Even as far as manually write .meta file, to load as an external asset, somehow?) I can't find anything suggesting it's possible.
In the Editor, this works great: dataProvider.GetDataProvider<ISpriteOutlineDataProvider>().SetOutlines(spriteGUID, outlines);
However, I need to do it during runtime.
The only alternative I can think of, is to use the 'outlines' to build Mesh-es - all sharing one Material, individually offsetting the shared Texture.
Notably, estimated upwards of 5000 'outlines' (shapes) per image/texture - whether sprites or meshes.
I actually ended up updating to 2022.3 since I looked and my game wasn't effected. So I'm going to try to use the draw outline function
I considered going back but from what I saw it's more complicated to go backwards
Yeah, normally if I have to test a new version of Unity I use a repo management system like GitHub so I can have a quick back just in case.
Depends on which version of Unity. Unity added a few API that could possibly help for runtime, but I would have to see which version for the supported API.
I'm currently using 2023.2.10f1 - so should be pretty up with the new versions. What's the API you're referring to?
So just checking beofre I answer this. You have several sprites you want to combine together into one sprite sheet during runtime.
The file you want to save this, is there any specific file format you want it to be or are you just wanting to save into to a new sprite file itself.
Also does this file stay after the game closes. So the asset would actually be saved to your desktop if it was a desktop game.
Close, but not quite exactly. I can see how it was interpreted that way, though. (Also, meant to 'Reply' - woops)
I'm making puzzle-pieces out of a supplied image; however, I want the result to be saved to a file. (ie: A sprite sheet, or otherwise custom file)
I already am generating point-arrays that outline the shape of each piece, and can save that to a custom save file - but that just defines the shape/points.
I already can create individual textures/sprites, copying from the source image - but that's messy and inefficient. I'm trying to improve that. Ideally with sprite-sheets, or perhaps mesh-generation.
The point of saving the file is to be able to resume/share the resulting/created puzzle. So the format is moot, if it offers what I seek.
Let me open up Unity and see the name of function I am looking for. There is actually a one line command that send back the outline of several sprites/tiles and can be used to generate a new sprite like that.
For the saving file part sprites can actually have scriptable object data built into them or linked to them. There is API to do that during runtime as well. One way might be to have an scriptable object that holds a list of resulting sprites.
Long as what you're refering to isn't this -
dataProvider.GetDataProvider<ISpriteOutlineDataProvider>().SetOutlines(spriteGUID, outlines);
'cause that's editor only, heh. Works great for creating custom outlines in sprite sheets, tested it already. Just... doesn't help for run-time.
And the whole point is to allow users to use their own images, during run-time.
No, I actually gave feedback to Unity team about the data provider last week on a forum post about stufflike that. More stuff needs to not be marked internal and also be usable outside of editor mode.
Nice, on the feedback. And fully agree. Yeah. Would love for it to be less internal. It's there, just... let me use it, dangit. Hah.
Also are you using Sprite Atlas to hold textures, because don't think my idea works for Sprite Atlases.
I don't believe I am using an atlas. Just the 'sprite editor' off an image.
Part of this push for sprite-sheet, is the assumption that having a sprite-sheet will be better/faster/less-memory/etc than generating meshes. This is an assumption, that I could be wrong on.
A) Load an existing sprite-sheet with 1000 sprites, displayed via SpriteRenderer.
B) Dynamically generate 1000 Mesh's, with MeshRenderer's pointing to a single Material, where each MeshRenderer independently sets the Texture 'offset' accordingly.
Correct me if I'm wrong - but (A) is the clear 'winner', right? Presuming it's possible, which is what my original question was.
So that depends on if you are using URP for 2D or not.
I am using URP atm. Though in a 3D game (there's a couple 3d elements, so it's not 100% 2d)
That still works with batching.
Let me test this code out and see if it does exactly what you want real quick.
Alrighty, muchly appreciate the dive into it. ... (Hey, I finally remembered to 'Reply' > ; P)
So after playing with it a bit there are a couple ways to do this depending on what path you want to go.
- Generating a texture and setting it as the texture used by a sprite renderer.
You can read the texture of the sprites you are wanting to fuse together. Get the pixels of the two sprites and create an array of pixels which would be an array of Colors.
You can use the sprites rect to choose which pixels you want to sample instead of the entire sprite sheet for when getting the pixel colors.
There is a function on Texture2D called GetPixels(); This one has overloards for x and y on the texture you want to test. You can use the Sprite rect to choose the actual sprite you want.
There is also a function on Texture2D called CopyPixels that allow you to copy those pixels to another texture.
You can get the pixels of the Sprites so there actual colors and alpha. Create a new texture from the two sprites.
Set a sprite render texture using the MaterialProperty Block and choose the new texture.
This will render your new sprite from the created texture.
Have to step away for a second, but will type the other solution out in a second.
That's basically the solution I started with, and currently have implemented - but it is not efficient. It creates lots of individual textures, and does so at runtime, so all of the GetPixel()/SetPixel() and texture-generation slows things down during loading.
It works, it's a solution, but it's not the solution I'm hoping for.
(Thank you for the write up on that one, though)
And no worries, I should still be here when you return; thank you.
Yeah, so you might want solution 2 or 3 than.
Solution 2. Use the Texture2D PackTextures function.
So funny thing Unity has a function that does most of the hard work for people in that case.
The PackTexture functions on completion returns an arrary of rects.
The pack texture function allows you to pass in an arrary of textures and what ever texture the function was called on will become a fusion of those textures.
So if you don't care about a lot of inidvidual control during set pixel and get pixel.
You can actual do that in one line of code.
Sprite SpriteOne;
Sprite SpriteTwo;
Texture2D FusedTexture;
public void FuseTextures()
{
FusedTexture = new Texture2D(width,height);
// PackTexture takes in an arrary of Texture2D, int for padding between the textures, int for max atlas size, and is new texture readable still.
FusedTexture.PackTextures(new Texture2D[] { SpriteOne.texture, SpriteTwo.texture },1, 2048, false);
}
You can fuse the sprites together using this texture till it is as big as you want.
With this method you sample the texture using the sprite rect position and pull that sprite in a sprite render.
I should note you can pack previously fused texture into a new texture to keep everything as one simple texture.
That's more for making several textures into one - I have the opposite problem. I have one texture, that I need to turn into several spites. Specifically, custom-outline sprites, that overlap eachother. (Rect will not suffice).
What I was meaning sample your sprites fused them together into one texture using this method than add the new sprite to the previously already existing sprites.
Edit: A visual example might be better for explaining that one a bit.
Wouldn't that make the image even larger? The sprites would need to have their 'buffer/transparent' separation? To be rect's?
And visual-example was just what I was thinking, heh.
There's a sample of an editor-made sprite-sheet.
Note that's just one 'piece', with a custom outline. There's lots more, as you can see by the several other boxes representing other sprites all around.
Oh okay so you have one thing that starts off as a bigger whole puzzle sprite, and you want to cut the puzzle into pieces.
Is that correct.
Yawp. One starting image, cut into pieces.
My thought was to make a spritesheet - just like this. -- That was made using the editor-only sprite-sheet tools, that I pasted a line from earlier. Really neat... just... editor only x.x
Notably, I don't want to actually 'cut the image' - I want the image to remain in its original state. Just the sprites/mesh-material/whatever, the render of the pieces - they just use the one source image.
Much more efficient. (ie: Sprite Sheet) [or: MeshRenderer, 1 shared material, w/ individual offsets]
My apologies, thought you mean started off with the smaller pieces and wanted to fuse the results into a bigger piece.
Okay, yeah that makes a lot more now.
Yeah, I wonder if SpriteDataAcessExtensions might be your friend than.
Let me see if it hasn't changed any real quick.
I haven't used that API in a while, so don't know if the split off the functions I am thinking of to it's own thing.
I think I heard the outline cut function was moved to a different extension script let me check real quick.
Yeah, problem is it's Editor Only -
dataProvider.GetDataProvider<ISpriteOutlineDataProvider>().SetOutlines(spriteGUID, outlines);
That won't work runtime. Or it'd be perfect.
I should note the sprite data access extension methods are run time usable like you want.
Wait what? How? Where?
UnityEditor.U2D.Sprites.ISpriteOutlineDataProvider <<-- That's litterally under UnityEditor ?
Yeah, so Unity really named this badly.
There is SpriteDataAccessExtensions which do work rutime than there is.
SpriteDataProviderExtensions
SpriteDataProvider and Sprite Data are sadly two different things.
One works runtime one doesn't.
If you see the word provider it is mostly talking about the editor only features, but ones that don't say provider have some runtime functionality.
I know it stupid naming convention.
Let me look into if they moved it anywhere differently since last time I looked.
Somehow I never found this in my searching.
Looking into it now, to try and figure out how to use it and see if it's what I need. --- If it is, that'd be the perfect answer and I'd love it.
Yeah, do note I think the function I used to use was split into a new class.
And they made this class more for vertex attributes.
They removed it in place of the SpriteDataOutlineProvider.....of course.
Oh wait I found the replacement process for this. Testing it out. and it is a lot simplier now by thelooks of it.
This is going to take a second to type up, but I tried it in Unity and it worked.
Was able to take a piece of a bigger sprite like the full puzzle you have and create a new smaller sprite that is just a piece of it.
Is it actually creating a sprite-sheet, though? Savable to a file? Loadable in a way that Unity will treat it as such, for good efficiency?
There's some approaches that can do it on the fly, but they all require building a mesh or sprite - instead of just using a sprite sheet. (Which is what I really want, since it's already efficient built-in by nature)
It might help for this to be a thread
For the moment I am capturing the sprite as JSON data.
You can save the sprite any way honestly want to. JSON or as a binary file.
Due note there is a function in Unity to save or load binary or json into any object.
Yeah, that is probably a good idea.
I've never created a thread before. Not sure how; or how to pull the messages into it.
Sprite Puzzle Thread
You should be able to click inside this now to type in the thread.
btw @swift knot it seems like the Handles.DrawOutline wouldn't work since it only seems to accept renderers or game objects, and as far as I can tell it isn't possible to get a singular tile as a game object from a tilemap
Going to create a thread for that topic to not muddy up the chat.
But it depends on how you are selecting your tiles.
For tile selection are you actually grabbing the actual tile class object itself.
Anyone ever tried to make sprites have some "Thickness" to them? Like the edges are rendered with some z-depth?
I feel like I've seen this done in games but can't find anyone talking about it
Something like this, although I'm not going for something quite so extreme
There are several ways to achieve the effect. The most common is to simply duplicate the sprite multiple times(shell rendering) either in the shader or or by literally having multiple copies of the sprite. Your example uses some variety this technique(you can see the edge artifacts caused by it.)
Other options would be voxel or raymarching, or using meshes instead of sprites.
How can I flatten the collider on my angled tiles?
I went and made "custom physics shapes" in the sprite editor but it didn't seem to actually change the collider
I'm struggling to find references to shell rendering that represent the technique you described
Most references to it I can find seem to be hair-rendering tutorials and not necessarily applicable
Well, that is the most common use of the technique these days
https://github.com/kurtdekker/makegeo/tree/master has a sprite extrusion geometry generator as an alternative.
https://github.com/MurabitoB/UnitySpriteExtrudeShader this is a geometry shader version
And for a texture based approach you'd probably want to look up parallax mapping for the underlying process
I'll check these out, thanks!
bumping this (sorry)
Editing custom physics shape work
You may need to reassign the collider component
what software (preferably browser) is recommended to draw tiles for my tilemap? im lookign to create some natural tiles e.g. water, grass, ice
Any image editing/drawing software that works with your art style and that you prefer to use
Aseprite has exceptionally good tile drawing feature, but it's mainly just for pixel art
Hey! I've noticed in our project that after upgrading to unity version 2023.2.8f from 2022.3.10, we started encountering a significant degredation in performance from our 2d sprite animation. From profiling we have found the culprit, which is the sprite deformation caused by using IK. Before, we had about 100 agents (with around 20 sprites rigged each) take a constant 5ms time to deform. However, after upgrading, the time has jumped up to anything between 50ms to 75ms, depending on hardware. This all comes from the exact same operations that previously only took 5ms. We have tried to combat this via multiple optimization techniques, ranging from toggling simple things like culling of deformation to more hacky solutions like editing the library itself to spread the deformations out over multiple frames. Has anyone encountered a similar issue? We also tried to downgrade the 2d animation package back to the original version, however the newer unity version doesn't support this and requires us using the newer package.
2D deformation's optimization is based on Burst compilation and Jobs
Check to make sure those are enabled
any suggestion for a good 2d illustrating program? (for 2d art, sprites, maybe even animating) - free/paid, I would like to be able to choose
Hey there, where can I ask a question about Particle Effects?
Just ask, you will be redirected if necessary.
Either #๐ปโunity-talk or #archived-code-general depending on what you are asking
thx
So I want to have some Ambient particles. They are slowly falling, but I would like them to something like ping-pong randomly a little on the x axis, so that they really seem to be moving. What setting do I use for that?
Also, is there a way to spawn a particle effect mirrored on one axis?
Ok, I did point you to #๐ปโunity-talk , remember? ๐ธ
Not really a #๐ผ๏ธโ2d-tools issue
alright sorry for that xD thought you ment this channel is okay too haha
the orange border isnt the collider add a tilemap collider with a composite collider then you have to change settings in composite collider to have a flat box like tile map collider
it worked for my game so you could try that out
you are right, I should have also shared this image
yes see the collider is curvy you want it flat right?
wait a bit
Ok
Hmm. It won't let me set it any lower than it is. But I can see that increasing it changes the mesh.
that seems to have worked, lemme check in-game
if I set it too high the collider on the sloped tiles disappears entirely
also I just now noticed that janky bit that sticks out way too high lmao
cause of low vertex count
I mean I saw that on the orange outline but not on the sprite
hmm, problem, now the collider is messed up on the square tiles
actually the sprites are 1028x1028 lmao my artist made them too big
i see was this happening before changing settings or after
the offset thing with the square tiles wasn't happening before I changed vertex distance
not sure what you want to see
gimme a ss of the full offset part
from where it starts to where it ends
its cause of the low vertex count
as you can see
it slowly gets tilted towards the top
since the connection points of the paths are low on count it will be weird on some places
How can I address this?
nevermind, I set the value to the right balance and was able to get rid of both problems ๐
Hmm. Alright. Different problem now. I figured out what's causing these spikes
in my art tool these sprites are exactly 2048x2048
but when I import them, in the sprite editor they get aliased
Is your texture max size smaller than your sprite sheet? If so, unity will downscale it.
Where would I find my texture max size
why the default sprite is taking place where it shouldn't.....anyone know about this need some help on rule tiles
There are two places; the texture importer(per texture settings) and the project build settings.
anyone?
I can't even understand your question.
Just checking are you asking why the Default Sprite for selected rule tile is being placed in certain areas that no rules match or areas that rules are matching for other sprites.
In Rule tiles in general the default sprite is selected when none of the created rules match and is used as a fall back option.
damn. I changed it to 16k and I still get a little bit of that spike.
Well, how large is the texture?
4097x6146
That is larger than 16k.
Oh, 16x is 4k by 4k not 16k by 16k. That totally makes sense lmao
Hmm. Ok. Now, how do I change the source image for my tileset without having to repaint my whole map
Hah, well, that I can't help with; not much clue about tilemap.
when im using a tilemap collider, it seems like my character is getting stuck on the edges of walls when im jumping into them
Composite collider component is meant to merge the tile colliders together for a seamless result
when i use a composite collider, as soon as my character comes in contact with the timemap it all falls down as if its affected by gravity
It's also an option to use a capsule collider for your character instead of / in addition to the box collider
This would happen if you give the tilemap a rigidbody component
The composite collider component only merges other collider types, it cannot cause falling
oh so im not meant to have a rigidbody component?
am i meant to delete the collider then the rigidbody?
Ah, that's a weird detail I forgot about
It should work as we want if you set the rigidbody type to static
still the same problem
well the whole timemap doesnt fall anymore
but it still catches on the edge of a tile when jumping
I'm fairly sure it should work
Note that the composite collider should be on the same gameobject as the tilemap collider
But if that fails you have the option of using a capsule or circle collider to smooth the sides of the character's collider just enough to prevent the sharp edge from latching on
my character collider is already a circle and a box, the box having a slippery material with 0 friction, and ive checked that the box collider is inside the circle collider, so it doesnt stick out
Either that's not quite enough margin there, or your character's physics don't allow it to slip down even if it's hanging just by the circle part
Or the physics shapes of the tile could be too weird for the composite to smooth out
im getting these errors but it still works. can i just ignore them?
Well, whatever that script is trying to do won't work.
but it does seems to work
Then you probably have some useless code you can remove.
well its meant to change the position of a layer in the background to create a parallax effect. the problem would be that i dont have a sprite renderer because the background is the game object not a sprite
if that makes sense
So why have it in your code?
is there any reason why the sprites arent going dark when theyre outside of lighting
this is the only light in the scene so idk whats happening
the sprites all have a material with sprite lit default
and im using urp idk if that changes anything
it worked before i switched to urp
Isn't sprite lit default the shader for 3d lighting?
What exactly worked and how? Only URP 2D supports 2D lighting
i have a tile map to create ground walls and ceiling for my 2d platformer. my character controller involves a floor check to see if it can jump, so that it doesnt jump just in the air, but since the whole tile map is together, it means that the character can jump when its touching a wall, making it scale all the way up. whats the easiest way to change this? making a new tile palette?
Add direction to the ground check?
do you know how i could do that?
You haven't said how you are handling ground checks, so not specifically.
well its checking for anything set on that layer
i just realised that it didnt save my tilemap layer, so now ive changed it and its just a tilemap layer
Ok, which tells me nothing. Is it a collider? Raycasts?
the character is a circle collider and a box collider for the tilemap im using a tilemap and composite colliders
that also tells us nothing about how the script detects groundedness
You will have to understand the script to be able to modify it
this?
You can probably adjust the m_GroundCheck position and k_GroundedRadius to ensure it's below the character, not to the sides
The radius relative to character's collider's width is not apparent here
uh dumb it down pls?
how do i make sure that it isnt
Examine your character's collider and compare to world units as well as to your k_GroundedRadius value
Adjust that value to see if problem disappears
how do i edit a circle collider so it shrinks uniformly around the centre?
or can i not do that?
That would be the radius
I would rather change the groundcheck's radius than the character's collider's radius though
i think i fucked something now because hes moving really fast
If you have more issues with your script rather than 2d tools it's best to explain the problem in #๐ปโcode-beginner
I'm working on a tetris game and I need to change the pivot mode of my L block for it to work properly, but when I do that only the collision moves and the sprite doesn't. Does anyone know what I can do to get the sprite where the collision is.
Nevermind
I ended up fixing it
Just needed to click "Reset" on my polygon collider
Hey guys!
I'm making a 2D game with a tilemap system where some tiles are terrain, some are interactable, some are quest triggers (which are a type of interactable), and etc.
Now if I wrote this game from scratch, this would be very easy. I would just make a class hierarchy of tile-types and have the game check which tile the player "touched" and respond accordingly.
However with Unity's system, this does not seem possible (unless it is?). For example, I made a tilemap with the tag "terrain" and that seems to imply that any tile from that map will follow "terrain" logic. Which then implies that I need a whole new tilemap for EVERY new tile type. Is that the case?
Does that also mean I can't implement a class hierarchy of them, where some tiles inherit from others? Honestly feels very suboptimal, I'm heavily considered discarding their system and writing it from scratch. But I'm very much willing to learn if I'm missing something!
You're missing Tilemap Extras package which has GameObject brush that I'd use for triggers in your case, doesn't seem like a quest trigger would really have to be a tile layer
You're also missing the concept of scriptable tiles, which let you use all the usual OOP inheritance when scripting tile functionality
Examples of scriptable tiles are included in the tilemap extras package
is there any good video showing how to use a scriptable tile?
I can't find any and the website has very minimal documentation on it
I'm trying to render a very large crowd of sprites.
I'd like for each person in the crowd to be subtly moving around, even if they aren't actually walking somewhere
Currently, I just have a huge pile of SpriteRenderers, each of which is drawing a sprite that depicts a few people (with a shader that makes them wiggle a bit)
But the shader is proving difficult (it uses voronoi cells to offset the UVs, and I can only wiggle them so far before weird artifacts appear)
I'm wondering if there's a better way to just draw a huge pile of sprites at specific positions and rotations
Particles come to mind, but I need to be able to actively move the people around
big clumps are attached to rigidbodies
It sounds like Particle System can do exactly what you need it to, and it works well with sprite renderers
But it's a bit unclear how specific the "active motion" needs to be
I Particle System isn't adequate, VFX Graph can do basically anything
Also, I'm targeting WebGL, so I can't use the VFX graph ):
I'd need to set the position of a bunch of particles every frame.
I see that you can just get an array of particles out and modify their positions
Why precisely?
the crowd is moving around, simulated with rigidbodies
so if I was using particles, I'd need to make sure that each particle followed its rigidbody around
how do i "scale from centre" brackeys somehow does it holding down alt but it doesnt do anything for me
If each character of the crowd has a rigidbody, you're not going to get any meaningful optimizations by avoiding sprites
It's many characters per actual rigidbody.
so each one is a whole blob of people
In that case why is it necessary to set particle positions manually? Instead of letting the particle system handle that
I guess it's an inconvenient middle-ground where I don't want to have an entire particle system for each group of people
Don't want to?
because the entire premise here was to just draw all of the sprites in one go, rather than having a bunch of renderers
A particle system and all its particles are one renderer
Right. And there would be one particle system per group of people.
Which isn't one renderer; it's many
One particle system per ridigbody sounds reasonable to me
yeah, I probably just need to go and profile the dang thing
Indeed
I wound up just sticking with sprite renderers for now because my performance was great -- and, as you noted, the rigidbodies are more costly right now
(much less costly after doing this, though!)
Sprite renderers (which are batched automatically) vs multiple small particle systems vs a large particle system with a loop overriding particle positions
I was seeing if I could do GPU instancing on the sprite renderers. I was getting weirdly inconsistent results
Some frames would have just a few draw calls and some would be drawing each sprite individually in the Frame Debugger
Sprites use some type of dynamic batching I think
I'd just use a texture for the movement. One channel for the terrain height, two for flowmap.
Or just heightmap if there are no obstacles.
@civic knot Like right now, the way it works is, you build the tilemap in Unity and then you use code from collisions to detect which tile you hit
this is so backwards to me
what I wish I could do is, setup a class hierarchy of tile definitions, make an array of tile objects and then render that array
but unity does not seem to be setup that way at all
Well, that would basically be rewriting the whole tilemaps implementation
Which you're free to do.
I know but that seems to be the common theme with Unity, unless I just don't know how to do it.
I don't know how to separate UI logic from core logic
in this engine I mean
Where did the UI come from again? How is it related to tilemaps?
So right now, I made a tilemap, and used the tile palette to sort of "paint" a map down onto the scene
and I commend the tool for that, it worked out great
But the issue is, how do I create abstract definitions for tiles that the UI/Scene can use?
Best way to think about UI separation is your tool should still be usable and functional without the use of the UI
I know, I want to create pure class definitions for my tiles
and have Unity's tilemap only render it
Can you provide an example?
Sure, that's possible as long as you extend the unity tiles.
private void OnCollisionEnter2D(Collision2D collision) { if (collision.gameObject.CompareTag("Tilemap")) { Vector3Int tilePosition = collision.gameObject.GetComponent<Tilemap>().WorldToCell(collision.contacts[0].point); Debug.Log("Player collision with tilemap at : " + tilePosition); Debug.Log(collision.gameObject.GetComponent<Tilemap>().GetTile(tilePosition).name); } }
Okay so this is what code I have so far. This code can tell me which tile I collided with
But this means that the definitions for each different tile are going to be essentially goverened by sprite names
hence no abstract class definitions possible
(the reason I want abstract class definitions is because unity is not the only UI in this project, I'm also doing mobile and web non-unity based)
(and they all rely on the same definitions)
GetTile returns you TileBase. If the tile's actual type is one of your custom types, you can cast to it and use it appropriately.
So it's totally possible to do abstraction.
In fact, it even has implicit cast, so you should be able to get a tile of the right class.
Oh? Can I ask you to elaborate on that? Like if I had a class ExampleSpecificTile
ExampleSpecificTile myTile = tilemap.GetTile(pos);
That would work but would force the ExampleSpecficTile to derive from BaseTile which isnโt bad but essentially means I have to only use these tile definitions within unity
Like another project which might rely on the same definitions could not use them anymore because basetile does not exist there
I think you might be right, I may need to simply abandon the built in system
Wdym? Like a different engine?
Iโm using unity to build the desktop app. Iโm using another framework to make the mobile app
Both projects use the same core game logic
Well, you can use conditional compilation for example.
Unity relies on the tiles to be of a type it recognizes as they're used for internal logic. It's the same as if you say that you want unity physics without actually using Rigidbody and Colliders.
#if Unity
public abstract class CustomTileBase : UnityTileBase
#else
public abstract class CustomTileBase : OtherEngineTileBase
#endif
{}
how do major companies do it when the game logic class is not within scope of unity?
like if it's on a server
Is it the conditional compilation?
Usually in that case Unity just acts as a complicated view? No?
Receiving visual updates from the backend.
Ideally but I don't know how to make that work
here it seems even when I make an abstract class, it still needs to derive from some unity definition
I don't know the specifics of what you're doing, but If you want to separate your business logic from Unity completely so it can be "easily" ported to other platforms or ran on a server or whatever, then you're going to need to define your own tile logic/system in a pure C# land.
That doesn't make sense. If a class is on the server, then the whole logic should be on the server.
And then when updates happen in the business logic, events/updates are sent to the Unity view.
And likewise, Unity's systems/callbacks will send messages to the business logic related to what the user does.
Do you have a backend server that runs the game logic outside of unity or something?
And need to sync it to the client?
Indeed. Or I'm making one at least. It will run the core game logic and Unity only provides the client
Then you need a complete separation.
And some type of communication layer to handle messages between the two.
Then you need to convert the tile data from your server into a unity tiles that unity can render.
Yep
When you deserialize a message from the server, generate a proper unity tile
You'll likely need to ID the shit out of everything btw.
Oooh wait, I like that idea!
Wait so like, the server will provide some class, for example, TerrainTile
and then
I mean, it's not like you have too many options when you use separate engines for backend frontentd.
the unity/client will make a UnityTerrainTile which derives from TileBase
For example, TerrainTile is a tile type that cannot be walked over. That definition should be stored on the server
then I guess what happens is, on the client side, it's cast to a Unity tile type like TileBase as @civic knot mentioned
Is this a realtime game?
It's going to be a multiplayer real time game yeah
There isn't much to cast. When dealing with networking, you receive packets from the other end that you need to create whatever objects you need on the client side.
It's called deserialization and is a critical part of implementing networking.
Basically, it has nothing to do with class hierarchies, inheritance, abstract classes, etc at this point.
You literally send raw bytes at the client, and deserialize that into whatever you want.
Usually in the form of "Messages".
the networking aspect is very complex, I realize that and will be a whole different issue.
But even if this were a single player local game, isn't it best practice to NOT have your game logic classes be engine-specific?
For example if you wanted to change a tile to from Terrain to something like Desert, you might send a "TileChangeMessage", which contains the ID for the tile you want to change, and a string that contains the name of the type of tile we're swapping to.
Meh. Depends on the scope.
Yes obviously it's ideal to do so.
But it's hard.
And time consuming.
And are you really going to swap to Unreal half way through development?
Probably not.
Obviously you should separate code along domains all the time.
UI should be UI.
Logic should be logic.
While it might be beneficial to have them separate from the engine, it's not always possible. And also you can still have it separate with conditional compilation, as I demonstrated before.
Turn based games are much easier to do a full separation than real time.
To make it clear, your implementation depends on unity tilemaps, since you want it to render them. When you have a hard dependency like that, you can't make your implementation entirely independent.
The best you could do is abstract it as much as possible and use conditional compilation for parts that are impossible to separate.
What is this game anyway?
it's just a 2d top down tile-based game. But there are going to be so many different classes and so making a class hierarchy is so essential
Inheritance is never essential.
Well... more than 1 layer deep.
Is it like survival crafting?
Don't Starve?
Is this your first game?
Not at all, but I think that's one of the main issues really
in the past when I make a game
I write the entire class logic and then I write a separate rendering system to draw it
I'm not used to an engine linking them so closely
Well when you did this before, how does your business logic tell your visuals to draw things?
It doesn't. It works off a game loop
while (true) { update(); render(); }
When update() runs, it updates all game logic and then render() just draws it by reading that data in
Well I mean Unity basically does that too.
You tell your visuals what to look like and then Unity renders all that at the end of the frame.
Ish
When you write your own implementation, your rendering is dependent on your tilemaps logic and hierarchy. If you suddenly swap the tilemaps API, I bet your project would break as well. Since unity doesn't know what the tilemaps logic might be, it provides a basic interface(base class actually) for your logic that needs to meet the minimum standards of their API.
I mean you could do something where you define your own Interface for controlling the tiles, and then make an implementation of the Tiles that has that interfaces and extends from Unity's tiles.
Then just toss those objects into your system and boom?
But idk
I think you and @civic knot provided the best solution before. I think I might write the abstract c# classes and then convert them into a TileBase
that unity can work with
Alright. I just hope you know when we say convert we don't mean cast.
No no, likely what'll happen is
if (collideWithTile){ if tile.name == "terrain_0": // create the pure C# object and use its properties
(pseudocode)
And do what with it?
if (collideWithTile): if (GetTile().tile.name == "terrain_0"): TerrainTile mytile = new TerrainTile(); myTile.doLogic();
again, pseudocode sorry
but basically that
Why do you need to do the logic on your custom tile on the client side?
I'm not factoring in server stuff right now, I'm just showing that the logic for the game is being done in a non-unity defined class
The only case where I'd have it(if at all) is to represent the server data before converting it to clients side representation.
Why can't you do the logic in inheriting classes then?
Classes extending TileBase
because it's being developed as a separate project, regardless if it's going to be on the server right away
the core game logic is its own project so that multiple UI
can use it
Then use conditional compilation as I suggested. Your base class just needs to extend whatever platform/engine you're building on.
Because this creating of new object just to run the logic on it and dispose of it right after that feels like a very bad design.
Now I'm just curious, how is this normally done? Putting aside UI-logic separation and all of that
what is the general standard way of defining tile logic
There are no standard ways. But it's logical to extend whatever your engine requires of you and provide different implementations for different engines via conditional compilation. I feel like I've been saying the same thing over and over again for an hour now...
You can hide the conditional stuff in your own base class such that none of your logic beyond it depends on the specific platform.
That's how multiplatform stuff is usually implemented.
Speaking from my own experience with an online turn-based CCG.
- All business logic is ran on the server.
- Client is dumb and is just a puppet for the server.
- Business logic is set up in a way where it generates "events" that represent changes to the state.
- Events are sent to the client.
- Client interprets these events and, using data packaged in the event, updates the view.
- Player actions on the client generates events that're sent to the server.
- Server validates player actions and then changes the state.
Both the client and server have these communication layers that handle the incoming and outgoing of messages.
The view in the client and the logic on the server literally know nothing of eachother and can run separately.
Don't think this simplified set up works all that great for real time games though.
A player is fine with waiting a bit (like around a second) before seeing changes, and you can hide delays by queuing up animations and a bunch of other tricks.
I'm just unfamiliar with techniques for real time games.
@civic knot @pliant hearth you two have helped me so much!
I think what I'm going to do is go with the flow of Unity for now and implement it how it works best and then worry about separation when it comes up instead of trying to force it right now
Out of curiosity, do you guys worry about separation that much in your own games?
If not, why not? (just curious)
No, because it's a pain in the ass. Unity supports all the required platforms, so you can use it for all the builds. The only case I think justifies any separation is when you plan to change engines, which in itself is not always the wisest idea.
But regardless, I usually limit dependencies on the engine wherever possible, so if it's gonna come to it, it would be relatively easy to refactor it to work on a different backend.
The most I do really is write some "Wrapper" classes.
Like my NPC task scheduler needs to update every frame? Sure make a wrapper Monobehaviour that calls the scheduler's tick method in the Monobehaviour update.
I end up with a lot of monobehaviours whose sole job is just to bind some shit together.
But ya like dlich said it's though and kind of not in an indie dev's time budget.
This is the type of rabbit hole that can consume dozens of hours.
Even with AAA games, changing engines is a highly complicated thing and often ends up in introducing a lot of bugs.
how would you get a tilemap in unity to act as a sprite mask as well?
I attempted to get rid of small gaps between my sprite-based tiles by placing them in a sprite atlas to add padding, but it hasn't worked. What am I doing wrong? The platform is a single large rigidbody filled with smaller sprites which are its visible tiles (the rigidbody itself is invisible).
what the hell does this mean
Your collider is being controlled by something, so you can't edit it directly.
aight
So I've got a ground tilemap that spawns trees at a 50% rate on grass. These trees will need to be chopped down by players for wood and therefore each tree needs to hold its own scripts for health, drops, and more...
What are some of the first things you'd do in order to reduce the weight of all these game objects? Do they even need to be game objects? Trying to think outside the box here because I'd like to have about 100 trees on screen at a time which might start to bog things down.
Have the trees on their own tile map overlaid on the ground, when interacting with a tree find the appropriate tile and then do the interaction. Spawning the tree will be as simple as take the ground tile being spawned upon, then use its position for the tree tile
Interesting, so basically you'd have a tilemap with just the visual of the trees, but when they need to be interacted with (collided with, chopped down), you dynamically instantiate the things you need like the TreeHealth script, BoxCollider2D, etc (for example)?
just use a tilemap collider2d
Oh right, but for the TreeHealth script -- that's correct, right?
Nice, that is actually a super smart way to do it. I'll try it soon ๐
do a switch case based upon the interacted tile's sprite or similar to find if you're chopping a tree or mining some ore, and award the player the appropriate resource
how do I delete a sprite from a sprite sheet
You open it in an art program and remove it
Otherwise, just don't use it if it's in the sheet?
Open the sprite editor, select the sprite you want to remove, and hit delete
how do i get a pixel perfect camera effect on only some objects in my scene?
Can't, unless the other objects are not sprite renderers
is there another way to get a similar effect?
How similar precisely?
I want my player character, who points towards the mouse, to be on like a local pixel grid
so the pixels dont rotate
also im noticing that my pixels arent consistent
ill try to fix that first
guess i needed to use the pixel perfect camera anyway
I expect you will
Also, pixel perfect sprite rotation is a different beast from just pixel perfect sprite positioning
yeah i set up the pixel perfect camera without the upscale render texture
do you have any resources on pixel perfect sprite rotation? im a beginner so i have 0 clue on how to do it
https://docs.unity3d.com/Packages/com.unity.2d.pixel-perfect@5.0/manual/index.html
The documentation offers examples of the settings, as well as all the required steps
https://blog.unity.com/games/2d-pixel-perfect-how-to-set-up-your-unity-project-for-retro-8-bits-games
This official blog post has more examples and a bit more broadly explores the concepts of retro sprite graphics
thx :)
There is no real section to ask question about text or TMPro :/
When I migrated an asset from a temporary project to the main one, the icons (which are part of the text/"smileys") switched from being in front of the font to being behind (yes, the font is what draws this ribbon thing. It allowed me to make a nice effect that made the text very readable).
...Any idea of how I could configure TMPro to ensure the icons/smileys are in front of the font? Thanks
hey y'all. i'm working on some pixel art for an astronaut themed game. can i get some opinions on a sprite i made?
for example, i'm unsure about the straight row of pixels as the back of the back leg
The arms seem really short.
#๐ฒโui-ux unless it's a 3D tmp text
It is. the asset isn't part of canvas/UI. ...But I presume the behavior in that case would be identical for both cases of TMP
Can we display only the lines of the tilemap on the 'Game' tab?
#๐ฅโcinemachine message
Forwarding this here. Is there a good way to resolve rubber banding on a parallax?
It sounds like a bug in your code
Rubberbanding issues aren't inherent to parallax effects
Followed a guide by AdamCYounis on parallaxes for this. Don't really see what would cause the bug
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Parallax : MonoBehaviour
{
public Camera cam;
public Transform subject;
Vector2 startPosition;
float startZ;
Vector2 travel => (Vector2)cam.transform.position - startPosition;
float distanceFromSubject => transform.position.z - subject.position.z;
float clippingPlane => (cam.transform.position.z + (distanceFromSubject > 0? cam.farClipPlane : cam.nearClipPlane));
float parallaxFactor => MathF.Abs(distanceFromSubject) / clippingPlane;
public void Start() {
startPosition = transform.position;
startZ = transform.position.z;
}
public void Update() {
Vector2 newPos = startPosition + travel * parallaxFactor;
transform.position = new Vector3(newPos.x, newPos.y, startZ);
}
}
Hi I am trying to make a 2d game where i can launch stuff and the further you go the more money you get and the player is a water melon. does anyone know what to do?
As you were told already. Describe the actual question
"Does anyone know what to do" is too broad and vague
Draw it outside of unity, and import it
Then attach it to a sprite renderer
Any program capable of drawing
:teacher: Unity Learn โ
Over 750 hours of free live and on-demand learning content for all levels of experience!
can you name a website @sinful grail
no to draw
I named two ๐ธ
I mean. This is a joke right? Type "drawing programs" into google
what do you use?
Hell, ms paint, or whatever comes with mac
ok
do you think i can work with this?
or do i make him not stear into your soul (he looks scary)
Not directly
I think it's u build the project for free
The direct built one is paid
Yeah
it's well worth the money imo
I've been told
i'm literally on it right now
aseprite was the first 2d art program i purchased and i have never looked back
unity is messing up the colours on my pixel art sprite and i dont know why? what i did was press import asset, pick the png i just made, change pixels per unit to 16 and change filter mode to point no filter
is it on a sprite atlas?
becauss for a game like this, you will want a sprite atlas
also check compression
the default is wrong for pixel art
i found that by changing the 'format' to this it fixxed it but im rly new to unity and have no clue if thats the best way to have done it
send screenshot of the whole sprite inspector
i have never had to change the color format
that is one more dimension than 2D
yeah soz
this is the 'fixed' version
only change is from automattic to 32 bit colour
you see that little tab called default? try changing the resize algorithm/format
there should be an option for compression, where you select no compression
i think it is hidden due to your current settings
i think it should be automatic format
this inspector is not set correctly. but it shows the compression option
which should be set to no compression
this worked thank you
Why does this happen? I have this falling platform Rigidbody2D that is made up of individual sprites serving as the tiles. For some reason, in the editor, it appears to look normal. However, in the game view, these odd lines appear in between the sprites. How can I fix this, I've tried for so long...
(left is in editor, right is game view)
This probably happens because they are separate sprites and it has physics, i wouldnt know how you fix it but thats probably the reason
Maybe try using a tilemap
Also great art, what program do you use?
Because you are displaying pixel sprites at a scale lower or higher than the camera's resolution, sub-pixel rounding errors occur in pixel positions causing stretched or squashed pixels as well as gaps
Pixel perfect camera component is the only surefire way to combat it
Thanks! I use Aseprite to make my art. It's incredible, but paid. Though, if you don't mind putting in the effort, it's free if you manage to build the source code yourself.
Thanks for the support, but I managed to fix the problem hours ago. This was the problem though, thanks anyway!
I would definitely mot be able to do that, i use piksel because im already used to the layout and it was free even though is probably not that powerful, i just wanted to know. Aseprite is still a good option which i cannot afford D:
That's fine; I used to use it as well when I used to draw random pixel art stuff for fun. There are tutorials online to compile Aseprite, so you could use those if you ever think of getting the program (trust me, it's worth it).
Libresprite is a free fork of Aseprite which is a good alternative
Doesn't have all the features but should carry you until you get the cash
It's enough to ask on only one relevant channel at a time
Sorry
Is there a way to change where the center of my pixel art is?
Is it a sprite?
If so, you can set the pivot in the sprite editor.
(Otherwise, use either probuilder or your own script to set it.)
Can someone help me out with sprite masks i need to know ifs theres a way to know if a sprite is being partially masked out
How accurate/detailed information are we talking?
not that accurate
like if the sprite is or isnt being mask at all
Can you just use a collider or an AABB test?
whats a AABB test
i honestly might just be trying to do this the most complicated way possible
theres probably an easier way to do what i want to do
Almost certainly
yeah im just gonna do it a different way
Axis-aligned bounding box. https://docs.unity3d.com/ScriptReference/Bounds.html
It is a very cheap way to tell if two rectangles are intersecting, assuming no rotation.
It may help to explain in more detail what you want to do
Oh nvm I already did it a different way I mean probably not the best way but itโs fine and works
this is probably a better spot for my question #archived-urp message
i kinda fixed it but how do i make it have random pieces in the middle
if thats possible
^^ nvm
Hi, also on the topic of tilemaps and rules... I'm a little bit confused why the rule tile isn't applying to the tiles in the scene but in the little preview they appear to be working?
I have the red and blue ones configured but theyre just... not working in the scene
Got it figured out. Apparently I missed a step somewhere along the way that said you have to drag the Rule Tile asset onto the Tile Palette editor...
i have this cube i want to rotate normally, but whenever it spins it gets distorted like this. any ideas how i can fix this?
Transform scales are inherited down the gameobject hierarchy
Which means you probably have non-uniformly scaled the sprite's parent transform
does anyone have a good free or cheap 2d asset pack. Just trying to learn to animate them and create a little scene
I want to put in unity a custom cursor wich is a pixel art but is blurry. I have no commpresion and no filter but is still blurry.
Blurry how exactly
I made a 3d unity project, but I wanted to create a 2d scene. Why is there no option to create a sprite?
Is this in build or in play mode
Because you ALWAYS need to check a build to see how the custom cursor looks.
Sprite components are in the "2D sprite" package you need to install, which 2D project templates come preinstalled with
In modern versions of the editor the package manager groups typical 2D packages under the 2D "feature"
oh ok, thank you!
when importing aseprite, is it normal that the pixel art in an animation gets weird?
left is ingame right is aseprite
it changes when going from the scene to the game too
while in unity
I wouldn't say it is normal, but it is a common problem if your texture import settings aren't set for pixel art.
And/or when using pixel art without either a smooth pixel shader or a pixel perfect camera.
I'd say the latter seems to be the issue here.
traditionally, what method is used for making props such as plants and flowers interact with the player when they walk on them. I don't think this is achievable by a tilemap.., so I guess do I just copy all the interactable plants I need into several different game objects for each map area?
Or is there a better way?
"Interact" how precisely?
You'll likely want those as gameobjects, which can be associated to tiles of a tilemap
Tilemap Extras package gives you the "gameobject brush" to streamline the process
Thanks!
For large amounts of them, a popular approach is to use shaders, and either use a texture or object position to feed info about what should be moving.
If you only want visible interaction.
I suppose it really depends on the specifics.
Shaders work too but they're generally a bit trickier to make
throught testing random stuff i found that if i make the character big it shows correctly, but i dont wanna make the character really big. I think I do have the pixel perfect camera package too
idk if i need to set something up tho
when scale is set to 5 it makes sprite bad but 6 works lmao
id like to know if theres a better solution tho
does the scale have to be a multiple of 2?
@lunar scaffold Sprite pixels get stretched or squashed if their scale or position does not perfectly match the pixel grid of the camera
This is a fundamental fact of rendering to a limited number of pixels on a computer monitor
Pixel perfect camera matches the scale and position correctly for you, so you won't be tweaking those variables forever
Or a texture antialiasing shader alternatively, as pinballkitty suggests
Which smudges the edges of the pixels that don't fit the grid rather than squasing and stretching them
Not smudges. Supersamples.
Effectively, the shader makes it as if you actually increased the texture size(making each pixel into a block of pixels) and then used normal texture filtering.
Actually increasing the texture size would work, too, but that is a pretty annoying workflow. And it greatly increases file size, memory, etc.
In the situation where the sprite pixel falls between screen pixels supersampling does smudge it between them
Perceptually that usually makes it clearer, though not sharper
That feels a lot like calling anti-aliasing 'blurring' ๐
Hopefully, this is the right place to ask (apologies if not).
In the attached video I'm getting some pretty strange glitching with my tile map background. I'm not entirely sure what's going on as the tilemap itself doesn't move.
It looks like some render error -- I'm using URP & cinemachine
How do i fix this (I want the player sprite to go behind the statue when actually behind the tower)
i thought id have to put them all in the same order in layer but thats not it
:(
Break it down conceptually:
If everything is on the same layer (ie. all on a background layer) then what matters is no longer the layer, but your sorting order/order in layer.
For example, if both your trees and ground tiles are on a background layer, you'd want the ground to have an order in layer of 0, as you always want to show that last. The trees would then be 1 or 2, something like that.
If your player character is on a layer of 3, it will always display in front of either of the aforementioned elements. You'd likely need to splice the sprites in half so that the top half of the statue is on a different layer than the bottom half. This is how I recall it being done in the past but I could be wrong
also worth noting if your objects have the same sorting layer the lowest one in your hierarchy will show on top.
I need to add the pose detector inside Canvas in my scenes how?
The what now?
Hahah sorry for the wrong explanation.....I want to add the Pose Detector using capsule hands into my 2D Scenes how shall i perform this?
What is "the pose detector"? It's not something that Unity has built in
Are you looking for #๐ฅฝโvirtual-reality ?
Using a Leap Motion device I am capturing sign languages in Unity using a package. This package offers pose recordings and pose detection, so I have already recorded some poses. Now I need to bring this to the 2D UI inside my scenes. I need a C# script for this.
It's impossible to say without knowing what package you're using. But the chances of someone here knowing that package and how to do what you want are pretty slim
I imported these files inside my Unity project to get the Pose detection and Pose Recorder
why does unity add this brown layer on my sprite?
its transparent
i dont want it
just somehow fixed it
Set Y as your custom sort axis and set every "standing" sprite's pivot to the point where they make contact with the ground, from an isometric perspective
Refer to this for 2D sorting priorities: https://docs.unity3d.com/Manual/2DSorting.html
Positional / custom axis sorting is used for objects on the same layer and order in layer, basically
Hey, does anyone know what causes those black additional lines to appear on some elements in TilemapCollider2D? It seems like everything is cut properly in Custom Physics Shape in Sprite Editor, at least judging by those green lines, but on those black ones, the character sometimes struggles to pass through and occasionally gets stuck strangely
do i need photoshop to make sprite sheets
Almost any drawing or image editing program will do
okay thanks!
can somone help me?
Make sure they aren't behind the camera in the z axis, are on a layer the camera is rendering, and aren't being sorted behind sprites/ui.
thanks
Need some feedback on colors and width of outlines. Working on a non-official community package update for Sprite Editor that allows for selecting multiple sprites and editing multiple sprite values at once.
In this picture I have a set of red rectangles that show previously multi selected sprites and a green rect showing the most recent highlighted sprite. I am looking for thoughts on default colors and width of the outlines to make it easier to see, but also making sure they don't make it hard to see the sprites selected.
I am thinking of making the outline a bit bigger and add the ability to change colors in Unity preferences. Does anyone have any suggestions for how they would like to be able to see whihc sprites are multi selected in the Sprite Editor.
Unity tends to use blue and green for outlines, and red only when there's a problem
It's not immediately clear to me what's the significance of a "previously selected" sprite
Unless it's implying the group of them are selected but only one of the selection is "active"
So there is a hot key to switch the UI between single sprite value editing or multi sprite editing.
The last sprite selected will have a different color to show when editing in single sprite editing mode what sprite is currently being edited.
When switching back and before between single and multi edit mode you don't lose context of the previously group of sprites. This allows for editing a certain value on a single sprite without having to reselect the previously grouped sprites.
Example of this you have sprites with the same width neding the same x value for a pivot point, but one sprite is two tiles high so you might want to edit that sprites y value seperately without having to lose the other selected sprites context.
Blender uses dark orange and bright orange for selected vs active
Maybe blue and brighter blue will work, but I'd avoid red in any case
Going to try the bright blue and dark orange real quick. Didn't even think of an orange color outline so curious to see how it looks.
Blue and orange are a good combo, though Unity rarely uses orange in its UI palette
ProBuilder has more colors which could work as a reference if you want to keep things consistent
Going to go through this and see if I can find the color value to add to the Sprite Editor.
https://www.foundations.unity.com/fundamentals/color-palette
How about dashed or dotted lines instead of a different color?
I could make a new material for the GL commands to draw for that. I have some preference options being made. I can allow people to choose which one they want from there.
So this is done in Unity. Using leap motion, I can show my capsule hands, but the problem is that when I show my right hand, the left hand appears on the screen, and when I show my left hand, the right hand appears on the screen.
Rename your left and right hand to the correct ones? =p
And maybe check where the problem is; whether the input is reversed or if you are just triggering the wrong object.
Hello I desining a map, and would like to copy-paste chunks in the same tileset, is that possible?
I know I can move then, but copy paste I dont know how to do, right now when I try is duplicating my tilesets in the hierarchy tree, thats not what I desire
You can click and drag to select multiple tiles at once from the tile palette to paint many at once
A palette can contain many premade structures
ahhh, so I duplicate and create premade objecs in palete, not on scene itself, that makes more sense indeed, thanks a lot
You can still copy and paste an area of tiles in the scene with the tile sample tool.
does anyone know of any good tutorials for creating tilemaps or environments (brand new to this, not sure of the correct terminology) for 2d games?
brackeys has a good tutorial on this
Every time someone recommends a brackeys tutorial, a cute pixel art puppy dies.
How do i draw text in the world? so not on the screen
Google "unity world space textmeshpro"
It has two versions. World space and UI
You can also use the ui version of textmeshpro inside a wirld space ui, if you need other ui stuff with it.
whats wrong with brackeys ๐
Outdated tutorials that often contain errors or misleading things
Which has people often coming here with problems because of them so he gets a bad rap
i used to love his tutorials when i was starting out but i never thought abt this. i guess im an old head ๐
He had one particular tutorial with millions of views that even when it came out was completely missing the script he says to use... at one point perps needing help with that one tutorial was like a third of the traffic in the 2d channel.
But generally speaking, he is attractive to brand-new users, who then learn incorrectly at the most formative stage and it takes a lot to recover from that.
Do Tile Palettes actually have any effect on tilemaps, or are they just a convenient way to pick tiles?