#🖼️┃2d-tools
1 messages · Page 4 of 1
yes the tilemap is useful for 2d pathfinding as well as world generation. you can get the locations of each cell in the tilemap and instantiate or activate objects / tiles depending on your needs, as well as having enemies locate objects on the tilemap and move from tile to tile toward them
Hey I am totally new and I am making this little game based of a tutorial. The tilemap never had any blue lines but all of a sudden (even though I have not changed anything) there is one between 2 chunks (I think thats what it's called)
Does it only appear in play mode?
yes
this is how it looks like in scene mode
https://www.youtube.com/watch?v=Wf98KrAyB2I is it something like this?
How to fix tilemap tearing and edges/gaps in a 2D Unity Project is much simpler than you think and does not require reimporting or manipulation of any of your 2D assets, a simple Sprite Atlas is all you need and I'll show you how to do that in under 3 minutes. Tilemaps in a 2D Unity project can be quite frustrating but fixing them is easy. Plea...
Thank you 🙂
yeye ofc
If that guys solution doesnt work, I swear the easiest fix was to change the grid to something 0.001. I'd have to check my old 2d project to see lol
haha thank you, it worked though!
gotcha! no problem- glad it worked :]
how can I make a tilemap collider trigger for every tile, for some reason it is only triggering enter when I leave a whole bunch of tiles rather than each one
and I don't have a composite collider either
send ur set up of ur tilemaps
native Pixel perfect camera (2D URP) wont work with camera stacking (what I use for parallax, especially parallax zoom) , anyone have an alternative method for PixelPerfect + upscale render texture, that would work with stacking? https://forum.unity.com/threads/pixel-perfect-or-upscaled-render-texture-with-2d-camera-stacking.948634/
I suppose you could use a custom post processing effect that upscales the render texture (though it can't snap sprite renderer position) or a parallax system that manipulates transform scales and positions instead of camera stacking
yeah I'd always done parallax that way for panning, but if you're trying to emulate zoom I find that http://www.procamera2d.com/ had a good solution in that you scale the orthosize of the cameras, and you use one camera per layer
rather than trying to "zoom" the world by scaling / translating
I'm looking into rendering to an RT at the res I want (640x360)
and rendering that on a canvas? I dunno i haven't done a lot of post/SRP style work
ok this is promising. giving me the results I'm expecting anyways
weird to have that "No camera's rendering", but I guess since I'm pretty much kicking everything onto a UI texture now
sweet, got CRT filter working too
whew, that was gonna put a damper on the day , hopefully not much of a performance hit to render one 640x360 RT on a canvas
can someone tell my why my character looks so bad
colors are mixed
and very low quality
looks fine in asesprite
its 16x32
change sprite's compression to none and filter to point
i see
Canvas is usually not meant to be updated frequently due to performance costs, but it may depend on use case
Gotcha- if I took the stacked camera output render texture and put it on a 3D quad and pointed a camera at it, instead of putting the RT in a raw image canvas , should be the same visual but more performant?
I think so, but only testing will tell definitely
Canvas from what I know is procedural geometry and must be generated again when it changes, but I'm not sure if the updating RT texture causes that
Yeah IIRC I remember reading to build performant UIs use many canvases so that when one updates it doesn’t redraw the whole screen when you update one widget
Ok I’ll try to put the output RT on a world layer sprite or an unlit quad
My post effects should work either way
Gonna do that next year tho - happy new year @modest cargo !
Yeah. Doesn't need any special setup.
So I'm trying to generate a 2d shader based on this tutorial:
https://m.youtube.com/watch?v=ACyqpLh4jrs
But even after installing URP, I'm lacking the last 4 options.
(1st picture is the tutorial image, 2nd picture is mine)
Course 60% off (LIMITED TIME ONLY) : https://www.udemy.com/course/create-a-moody-atmospheric-dark-2d-game-with-unity-c/?couponCode=COUPON60
My Socials:
Instagram: https://www.instagram.com/the.gamedevshow/
Tiktok: https://www.tiktok.com/@thegamedevshow
Twitter : https://twitter.com/thGameDevShow
Videos like mine:
PolyMars - Making Games t...
I'm new to gamedev in general, I wanted an opinion, is this too big for a character?
it's for a project planning to star
That depends entirely on the game and the intended display resolution
Only you as the developer can answer that question
Would love help on this because no one has responded to me on reddit 
dawn, makes sense, I was planning a turn based rpg, thank u anyway
Prototyping is important, as well as simple placholder art
When placing your character in the prototype project you'll pretty quickly see if say, the character appears 6 pixels tall and all the effort you put into detail is wasted
thanks, as I said I'm a noob at gamedev I will make some prototypes ^^
when i imported animation for my 2d character it disappeared
how can i fix this
i noticed that animation is happening in background layer
how do i fix this
nwm i somehow fixed it
why is it that i can't slice in the sprite editor?
You can only slice "multiple" type sprites, for one
yeah i figured that out after one google search, which is probably the place i should have started with but still thanks
Does anyone that has a good idea of Rule Tiles think they could help me out? I want to get these tiles to create a wall like this, but i'm having trouble getting the rules for it right
Heres some examples of what they should look like
idk if it's too big but it's soooo pretty
love the style man
thank u, its my 1st project, I have made many pixel arts before
it does look really cool
thank u guys ^^
Anyone got an idea why this is happening? I'm getting close to the result I want
Define 'this.'
dw its solved
Hello i wanna make some pixel game art and idk if there is any pixelart people in here but if you could help me with figuring out the size of the player sprite in this picture.
I wanna make pixelart myself and I found that pixelarchitect on Youtubes art looks very detailed and good so I wanna draw mine at the same size.
It is the player sprite I'm asking the size of
Down at the bortom it says that the entire picture is draw in 640x 360 pixels if that help but I do not know if the picture is zoomed in or not so.
I tried with my eye to count the player pixels from to pto bortom i got somewhere between 49-51 and that seems off? Usually sprites are in 8,16,32,64 right? So could this be a custom size? Plz help if you can
when we speak of an 64 bit character, that doesn't necessarily mean the character is exactly 64 pixels tall.
Just eyeballing it, looks like 32x64 sprite but not using the entire size. Though there is no guarantee that the artist is actually working to a grid for the character at all.
Forgive me if this is the wrong channel, I'm new to Unity.
I have a camera outputing to a "Render Texture". But when I try to apply that texture to something, it doesn't show up in search?
Alright I answered it myself. I needed to apply the texture to a material, and then apply the material to the object.
Why does the sprites overlap? I used 2d sprites in designing and now when a panel appears even if it's above it, the sprites is still shown on top. How can I make it not overlap?
Anybody know how to set the background image for a 2D scene? I don't understand it from googling it alone
Hi there. I'm getting an unslightly line beneath my main character sprite during animation, even though I've packed it into a texture atlas. Can anybody suggest a solution?
This is the character sprite sheet.
Filtering is set to point, there's no compression.
Wrap mode is clamp.
Padding is set to 8 instead of the default 4.
That is the base file, not the atlas?
That's the base file. I'm not sure how I can show you the atlas...!
There we go...
I'm also wondering how people normally do collision with 2D - do you do an entirely separate tilemap, or do you set up the collision for each sprite, or both?
Finally, I've also ended up with some really bizarre 2D collision from the Tilemap Collider 2D...
Note the grass square to the bottom left of the bridge, just below the pink circle. This area should be walkable, yet I've ended up with a duplicate of the collision from the tile below it (a sort of lopsided trapezoid).
Can anybody suggest what to do here?
Hmm. I seem to somehow have tiles under other tiles. Hmm.
Time to call it a night.
You'll certainly want to remove the sprite slices that don't have characters in them before creating the atlas
Performance-wise, is it detrimental to generate high-vertex custom outlines for sprites?
I mean, it will be more expensive than not doing that... but the difference will be negligible in most situations. Of course, it depends on what you consider to be 'high vertex,' too.
I assumed that, but, the documentation says that it will lead to better performance, which confounded me. In terms of quantity, I don't know exactly, I'm simply using the automatic generate function from the sprite editor, which, from what I can see, generates not that many points, but I could be wrong.
Here's the documentation in question https://docs.unity3d.com/Manual/SpriteOutlineEditor.html
Well, generally speaking, rendering a transparent pixel is more expensive than evaluating several vertices. So if you can spend a couple extra vertices to cut out a big chunk of empty space, then you will usually benefit. That generally won't be what I'd call high poly though.
Thank you @modest cargo , will do that in future. As this is mostly a test, I guess I'll live with that for now.
Folks, if I'm looking to put pixel art on a recent iPhone screen (so something like 1179 × 2556), but also ideally put it on an average Android and later to Steam, is there a procedure I should be taking to ensure the game looks roughly the same on all displays? I'd know what to do with Unity UI, but I'm new to working with sprites here...
Supposedly the latest Pixel phone is 2400x1080 (2.22:1)
Hi! Can anyone explain to me why should I create the sprites in an atlas instead of invididual sprites? In the case that you want to change the atlas rows/columns I guess it will be a problem right? That wouldn't happen with invididual sprites, or am I missing something
There are many reasons to have the sprites packed into an atlas, but you can usually have unity create the atlas for you after import, and still work with individual files. You might still want to create in an atlas format for animation purposes
Yeah having them invididually and them create an atlas from them on Unity was my current approach but I see that a lot of people create them as an atlas directly
Well, a lot depends on your overall workflow. Building the sheet yourself also gives the most control, of course.
And of course, a lot of people use external software that exports as sprite sheets, so that's a good reason right there 😄
You can tile it, or create different versions for different resolutions.
hmm..I'd like to have the 2D edge shading from the original box incorporated into the overlay though. Is it possible to tile it as an overlay?
Depends on how you're overlayingit
you could also just nineslice with a tiled center
ooh that sounds like an idea! do you have a link for how to do both 9 slice and tile on the same image?
I'm not suggesting it just for optimization, but also to troubleshoot the problem
The sprite sheets colored background pixels should not be able to leak into the sprites when using a sprite atlas because of the margins, but it looks like it happens anyway
Without the excess sprites in the atlas at all, it would be impossible so if it still happens after removing them that means the atlas isn't being used for whatever reason
Note that you won't have to modify the sprite sheet for that, just select the sprite slices you generated in sprite editor and delete them, then recreate the atlas
i am using a render texture with resolution 640 x 360 to get a more pixelated look, however, the color of urp/lit materials with emission appear very dull. how do i make the colors of emissive materials appear in the render texture like how it actually is in game?
Changing Color Format R16G16B16A16_SFLOAT could be a solution
The render texture needs to support HDR and to be able to store the necessary color information
Assuming that's how your project is handling high emission values
i see, this resolved the issue. i thought itd be related to the color format, though i wasnt sure which
Hi! Does anyone know of a tool with which I can organize the assets of a sprite based game, to make it easier for my artist to make level and interior decorations. My idea is that there would be something similar to the tile palette but with assets organized by categories and perhaps if these could already be prefabs with characteristics (colliders, scales, scripts, etc) it would be better.
Ah, 10-4.
I've moved onto a different sprite sheet now, but that was good advice, appreciated.
Hi people! Is there an API to calculate the real bounding box of a Texture2D? For example a 100x100 texture all transparent with only a 20x20 speck of color in the middle, I would like to ask Unity and have it respond to me something like (20, 20) or Vector2D {20.0f, 20.0f}
Meanwhile I came up with this kind of thing...
using UnityEngine;
public class VisibleTextureRect
{
public int x;
public int y;
public int width;
public int height;
public VisibleTextureRect(Texture2D texture)
{
int imageWidth = texture.width;
Color32[] pixels = texture.GetPixels32();
int x1 = texture.width;
int y1 = texture.height;
int x2 = 0;
int y2 = 0;
int row = 0;
int scan = 0;
foreach (Color32 c in pixels)
{
if(c.a > 0)
{
if (scan < x1) x1 = scan;
if (scan > x2) x2 = scan;
if (row < y1) y1 = row;
if (row > y2) y2 = row;
}
scan++;
if(scan == imageWidth)
{
scan = 0;
row++;
}
}
x = x1;
y = y1;
width = x2 - x1 + 1; if(width < 0) width = 0;
height = y2 - y1 + 1; if(height < 0) height = 0;
}
}
it seems like working, but still, if there is something built-in I would prefer to use that. I tried to google with no luck before doing this.
is there a way to replace a 2d animation with another sprite to not have to reanimate each sprite
someone mentioned this was possible but i dont know how
or i misunderstood
i just replace the sprite in the originally used png in photoshop or whatever and it updates automatically. Might be misunderstanding the question though.
Is there a way to group select sprites in the Sprite Editor and change all their pivot points at once?
Not in the editor, I believe, but the .meta file that contains the pivots should be able to be modified externally in whichever way if you delve into it
Aah. I get you. Hmm. I'll look into that.
I'm having a situation where the 2D grid doesn't seem to match up with the objects in my Tile Palette. I'm currently twisting all the dials and flipping all the switches, but if anybody knows what's going on here, I'd appreciate a pointer.
The sprites' pixels per unit value should match the intended pixel size of each tile
I would stick to one-unit grid to minimize relative scaling weirdness
I think we might be meaning different things. I kinda mean for making new characters. I'd like to copy the animation files from the previous character and then just use new sprite sheets on the current characters animation file, but if I were to replace it like how you're saying I think it would replace all of the characters with that sprite which is not what I would like. Just the current character for new character creation I would like the sprite to be replaced
I believe the free shoebox tools on the asset store has a tool for that.
Hello, importing 2d textures onto unity and ive been trying to find how to align the grid with my textures pixels
i found out the grid size should be 512 units. But there is this small offset that seems to being present that i cant figure out how to fix
Why that much?
I would go with 1x1 grid and alter the texture pixels per unit instead
How may I do this instead?
Have you changed any pixels per unit values?
Pixel perfect camera component may help with the rendering, and to place the sprites accurately on grid in scene view I would use grid+vertex snapping or type exact values for the transform position
Hello, is it possible to add a Physics Material 2D to Only One side of a Edge Collider 2D for a Sprite Shape? as shown in the picture? I looked everywhere but couldn't find an answer
im really new to unity so this may not be a good answer but i would use more than just 1 collider
.
anyone know how to get rid of the tile pallete selector
solved
I was afraid that was the only way, I hope there is another alternative as that would require a significant amount of time considering how many unique platforms I have in the game
Using primitive colliders is usually better. For example you platform in the above picture could easily be approximated with three or even two box colliders.
I agree as that should have been done but that doesn’t fully solve the current situation as these platforms are already in a live game and I can’t change the collision as that would highly alter gameplay, speed runs times, ect…
@solemn latch - thank you, I'll investigate these! https://assetstore.unity.com/packages/tools/sprite-management/shoebox-tools-for-unity-35760
Does anybody have any experience using the Sprite Resolver / Sprite Library asset and component? I'm having trouble getting sprite replacement for characters in a Zelda-style 2D environment working correctly. I'm following this tutorial - https://www.youtube.com/watch?v=6mNak-mQZpc - and have reached 8.55 . I can add the Sprite Resolver properties and get the correct sprites keyframing in the timeline, but if I remove my original sprites from the timeline, I can't see the character at all in the Game view. Is there anybody out there with some experience with swapping out Sprite Sheets? (I'm going to have to leave my computer for about an hour, but if anybody has experience with this please tag me and I'll get back to you very soon...!)
In this video I will show you how to use 2D Animation package and its Sprite Resolver and Sprite Library to create reusable 2D animations.
Previously if we had multiple characters with exactly the same animation we have do create Animator Override Controller and recreate every animation using the sprite for the other character. This was a lot o...
How can I attach a texture/shader to a sprite?
I got some shaders from the asset store and added them to my sprite renderer, but my sprites did not change at all.
what is going on
Folks, I have a bunch of sprite sheets (about 16), all with the same grid spacing for characters. Anybody know how I can apply the same Sprite Editor slicing to a group of Sprite sheets all at the same time?
hi folks, uber-noob here! just started this week and am having a weird issue with 2D Collision. The green boxes SHOULD represent the Tilemap Collider for the walls/door here, but instead they are reaching all the way out to this red area. My character can move just fine, but it is trapped within the red area. Nothing I am aware of indicates how/why this is the case. Any advice? TYIA!
you could make them into one large sheet first
Sadly, I don't think that would work with the Sprite Resolver. That seems to basically need several sheets of animated sprites in the exact same positioning.
Regards your problem, @pastel abyss , I had something similar just recently where I had multiple tiles overlaying each other on different 'heights' (see the Tile Palette). I deleted the offending tiles and replaced 'em with single non-collision tiles and it all worked out, seemingly. Not sure if that's your issue, but might be worth a shot...!
I'm not sure what you mean by "heights"
Yep, that was unclear, sorry. I'm referring to the Z Position, as can be found at the bottom of the Tile Palette - see here:
I see. My Z position is locked and I have not done any sort of overlaying tiles. just really weird random collisions.
I'm baffled. Completely restarted an entire new project from scratch, ONLY the PLAYER and the WALLS have any sort of collider on them. The FLOOR is on its OWN TILEMAP (again NO COLLIDER), yet somehow my player is stuck in a 5x8 grid in the center of the floor...colliding with NOTHING. Nothing shows up under contacts. 🫠
How do i determine what the origin cell of a tilemap is in the editor?
In your tile palette inspector area did you select the right grid to place it on and not the grid that has the collider attached to it?
yes. you can see in the image, the green boxes are the only colliders that should exist other than the player's own.
On the tilemap that is the solid objects do you have a tilemap collider?
Can you show a video or through pictures how you're placing your ground tiles in the world?
sure, here you can see I have the floor tilemap with only a renderer component. The walls are on a dif tilemap with Tilemap Collider 2D, Rigidbody2D and Composite Collider 2D. The palette contains all the dungeon tiles (and the player sprites).
the tiles were just hand-placed 1 by 1. for some reason, the colliders on the walls are reaching WAY farther than the boxes would indicate
In your tile palette when you place the floor did you select the correct one? Then placed it..
yes.....
No idea then.. try removing the composite? and see if it fixes the issue..
i have already tried that... again i restarted from scratch lol its just for some reason the colliders are HUGE.
Try editing the colliders in the sprite editor..
i did already. the green boxes....
if its in the top result of google i have tried it lol thank you for trying tho
Maybe ask in a different channel so more people see it and see if someone else has a solution..
that is what literally every channel says lmao i dont think this place will help with this problem
Maybe a weird unity bug.. What version you running?
2021.3.16f1
@wraith bay .meta file contains sprite slice information in text form, so to some extent you can copy-paste settings between sprite assets
Has anyone gotten Dragonbones to unity export to work recently?
Can anyone help me put my damned tiled background BEHIND all the other sprites? I tried using sorting layers but it only goes behind the player and other game objects, not the floor or walls itself
Could it be an issue with your movement script, and not the tile map?
possibly, but its a relatively basic 2D movement setup. I'm almost certain its an issue with the colliders
inspector shows that none of the player's colliders are in contacts with other colliders (outlined in green). Somehow the wall blocks are "larger" than they should be (red boxes). If I place only a single 16x16px wall with a box colllider 2d, it extends to cover NINE TILES... really dont get what is happening
Does your composite collider have a radius?
Is the collider of your player correct?
Mmm not sure if I'm saying something plausible, but... Could it be an issue with "pixel per unit"? Like, your sprite is ppu X and the colliders somehow get scaled as per ppu Y? Maybe it's impossible, but it's the only thing I can think about when I read this
Or you have a script tampering with collider shapes and you forgot about it 😅
this might be relevant, can you elaborate more on how to check these settings? (also the only script I am using is incredibly basic YT tutorial movement
the composite collider does/did not have a radius set, the same issue occurs even if remove the composite component altogether and just use a custom box collider around a single tile
Really, desperate for another set of eyes on my Sprite Resolver problem. If anybody has experience with this, or is happy to be my 'debugging duck', please let me know and I'll go over it in Discord...!
And the player character?
And other objects hit these enlarged colliders?
And if you set the box collider, can't you shrink it down?
Fucksake. The problem wasn't with the Sprite Libraries, I just needed to ensure the Sprite Renderer on a different layer. =/
hello i have script for score and its correct but its not working and
I can't transfer to the marked location. how should i go about.
so I'm having some sort order woes...I have a bed that i want my character to be under when he's on top of the tile, but I want him to be in front of it when he's below the tile. To make matters worse, I can't use the Transparency Sort Axis in Project Settings to solve this because I'm using another Scriptable Render Pipeline Setting.
Is there another way to get around this issue? 🙏 🙏
will I just need to change Sort Order on the fly with code or something?
Why cant you change transparency sort axis?
If youre on urp you can still change it
Because that would mean forgoing my pretty light LMP scriptable render pipeline. Unless there’s a way to have my LMP scriptable render pipeline as well as transparency sort axis in project settings?
Hm idk never heard of it
Have tried getting in contact with the aseet author
If its an asset
Hmmm I can’t remember how I got it 😦 does the Universal Render Pipeline do light sources well enough? Maybe I could just use that instead
You can, such as by changing the sprite's order in layer or its depth position
or any of the other means used to sort sprites https://docs.unity3d.com/Manual/2DSorting.html
Old games used to have the bed sprite split into two, the blanket up top rendered on top, and the blanket at the foot rendered below
Did we have a tool to create png spritesheet with transparency from animation in unity ? 2 years ago we had recorder something something but it never worked properly
So the old school method would work if the bed sprite was 2 tiles long, but it’s more like 1.5 so his head would still need to be above the sheets when in front, if that makes sense.
I may just need to get creative with sort order stuff in code. Wish me luck! 💪💪
Get creative. One trick I used to solve a similar issue was like to place triggers around the bed to change the character sort order on the fly
I guess the simplest way is to change the depth position a bit based on the player's position
But that might be a problem if the custom sort axis is used in some other specific way
Dunno what you mean by "LMP" or "using another SRP setting"
Ooh that Z order thing might work because I’m not using the transparency sort axis…I might just see if I can change the sort order when the player interacts with the bed.
Sprites always use depth axis for transparency sorting (among other methods), unless you define it as another axis in settings
Just run into this problem. I'm using 2D BRP, an axonometric pov (think 2D Zelda) and I have a bunch of spriterenders moving behind my character in a queue. Sometimes they'll be above my character, sometimes below it (in terms of Y) - and I want to have characters that are 'higher' in Y to render behind my character. I can think of how I could code this second by second, but surely this is an issue with some fairly standard solutions, given how many axonometric games are on the market...?
...And there was, I changed the Transparency Sort Mode to Custom and set the sort axis to 0,1,0.
hey so i made a tile specificaly for this situation but its still using the other one
are bones for 2d sprites removed?
im watching this guy make a characther and he just added bones and there doesn't seem to be any in 2021 version
It is the '2d animation' package.
its downloaded and unlocked, still cant find it
Your tutorial might be incredibly out of date
Have you looked at the documentation?
im looking rn to find a way i understand
yes the person uses 2018 version, i have 2021
Look up tarodevs tutorial his is the best and most up to date
How can I make so that TextMeshPro also only appear in front to the mask, just like the sprite?
hey guys, I am making my own Flappy bird, so I created a bird for the player, but when I imported (imported as .tga) it has small, so I change the scale but he look link this, and it's not supposed to look like this, how can I change it to look normal?
this is how its supposed to look like
Even not scaled it look like the first pic
turn off compression and filtering on the asset
A could find the compression, but the filtering it's already turned off
now it worked, thanks
really appreciated
Why I'm getting this weird lines on my tilemap? I turned off compression and filter.
It's a problem I've had to. Setting grid size to 0.999 fixes it, but that's not really a good solution
@glad nimbus @uncut forge #🔀┃art-asset-workflow message
Here's a short explanation of two most common causes
Folks, I had a 4-direction sprite sheet for a character in a top-down 3/4 view and I have it setup with a 2D Blend Tree for animation - but when I move the character(s) in the ordinal directions, I'm not triggering vertical or horizonal animations. Any ideas?
add more motions for diagonals. if you dont have sprites specifically for diagonal facing, you could use the Horizontal movement animation instead. try it out!
Is your movement script actually feeding the values into your animator?
So I created this prefab by combining multiple png files, I turn this into a sprite so I can use the Sprite Editor to add bones and stuff, but I can't add the prefab into the Sprite field in the Sprite Renderer component, anyone know how to?
@pastel abyss - I tried adding more motions for the diagonals, but whenever the motions didn't exactly hit the diagonals, the characters would freeze their motions also. I was wondering if there was a way to increase the 'activation zones' (the blue pools) to ensure the interaction was captured or something, but it doesn't seem like that's possible in a useful way.
try using 0.1 and -0.1 instead of whole numbers
Yeah, absolutely - the Animator Controller parameters and visual feedback are all responding appropriately to the input, and the characters run when the ordinal directions are clearly invoked.
I've done this, but it seems to have just proportionally reset the activation zones...
Yeah, again, on test, the characters only animate sufficiently on ordinals.
you arent utilizing anything on diagonals
also can you share your player controller script?
Correct. So I only have four directions animated in my sheets, and I'm trying to set it up so that when moving in a diagonal, one of the four ordinal directions are triggered to cover for this, as you would have seen in old 3/4 Axonometric games in the past (eg. Chrono Trigger).
I'm happy to, but it's a horrific mess, as this is the first time I've been playing with Unity 2D in this way an I've been hacking stuff out.
My apologies in advance, this shit is embarrassing.
Just tested setting the Horizontal values to .1, but that seems to be having the same issues.
is there any alternatives to photoshop to create psb files for sprites?
could i use gimp?
do you specifically need a .psb file or just a tool to make sprites?
Yep, seems like, though you'll need to test in Unity to see how effective it is.
basically im trying to make a character but to add bones, i have to use the skinning editor which means my gameobject has to be a sprite
what i did was i had a bunch of png's and combined them to make a gameobject
but i cant use the sprite editor because on the inspector, spire renderer, the sprite field is empty, i cant assign my game object as a whole (i tried putting in just the png of the torso thats why it says body there)
but then sprite editor only opens the torso part
every tutorial online makes a psb file and edits the sprites like that so idk what to do
Yes, with caveats. Most software that can create a PSD(with converter) or PSB file doesn't actually provide the metadata Unity is looking for, so while it will usually work you can have subtle problems later- especially if you try to edit your existing PSB file.
right on. .psb is an extension for photoshop files. you dont need that specifically
what can i do in my scenario then
how can i add bones to my gameobject up there
i cant add the gam object "character" into the sprite field or the prefab or the object
you need to find the prefab image in your assets and drag that onto the sprite renderer? i think?
yeah doesnt work tho
when the drag it onto the field it just goes gray doesnt allow me to put it in
Still really stumped with this ordinal sprite nonsense.
what do you mean?
I would set specific values rather than feeding in the input, definitely
2d sprites don't 'blend' the way 3d transforms do
The easy fix is putting the tileset into a sprite atlas.
I done this and never had the issue again.
whenever i inport a tile for my tilemap it gets a white outline like this
how do i fix it? i am importing pst files from photoshop
Forgot to say, @solemn latch , your advice fixed the issue. Of course Blend trees are dumb for this...!
Use a transparent shader
Create a blend tree for the idle facing directions...
Oh, sure. Hey, that's vestigial from the previous version... and it ain't hurtin' noone (yet).
? Sorry, so that piece of code sets the parameters if there's any input. I'm not sure about the relevance?
Nevermind, haha.
Was I missing something?
i dont know if this is the right spot to post this but is there any way to make the sprite fit the shape more? (its 3 seperate blocks)
Those handles are just the rect transform controls; it should adapt to a multiselection
Does anyone know how to detect when tiles are deleted/destroyed? Because I can Find all the tiles and the tiles that are null, but not when they are destroyed. Any solutions?
Hello is anyone able to help me know why my rule tile isnt working with my tile palette
My tile rule is in my palette..
i want to make a celuar automata. I have drawn arows and created a tilemap and a pallete but when i paint on it the sprites are so tiny.How do i make so that the sprite fill the whole cell
and also if i want to acess a sprite in a tilemap with given x and y values will the z parameter be 0 or the z cord of the tilemap -1 in this case
why won't polygon collider 2d match the sprite?
I don't know if there's a way to make it automatically match the image borders, but I am sure you can edit it manually
Hey, u use Unity on Phone ?
i have trees. the player. the backpack.
sorting layers dont seem to work the way i would have though
thought
if i put the player and his backpack on the same sorting layer. and the trees seperate. it still changes the trees?
I want the backpack to be behind the player
but when i set that up. all the trees are always behind the player regardless of position :/
Pixels per unit in import settings I think is what you want.
so when renaming a psd file to psd, do the layer IDs not transfer over?
when i'm in the skinning editor in unity i cant seem to be able to organize the sprites based on layer folders and such
anyone know a work around?
actually is there an asset that just does sprite rigging better than unity?
nvm
im an idiot
I didn't realize i had to click on sprite tab
There are two callbacks from Tilemap class. One of those does what you want
@spiral solar No not really XD
I use it that way. I’m not at my desk but one of the two callbacks returns “synctiles” which return position and tile instance iirc. If instance is null then the position is where are deletion occurs. It’s in a free asset and works fine. Maybe you’re trying to do something else?
although this one (TilemapOntilemapPositionsChanged) can be easier to use. Both work at Runtime in 2022.1 and later. Earlier versions are editor-only https://docs.unity3d.com/2022.1/Documentation/ScriptReference/Tilemaps.Tilemap-tilemapPositionsChanged.html
Use sorting layer groups
sorting layer groups isnt working ):
it just treats everything like its in the same layer group
the engine seems to only care abut Order in Layer
does not change at all when using Sorting Layer
Order in layer is the order within a sorting layer
It does work as explained here
https://docs.unity3d.com/Manual/2DSorting.html
Sorting layers take higher priority than distance to camera
Sorting group component allows you to override that within a hierarchy by inheriting the parent's sort order relative to other gameobjects
i think the reasons im having problems is because im making a 3d game with 2d sprites
and it still didnt work. but i found another fix
it was caused by URP messing with the layers
The sorting group component didnt work until i changed settings in the URP renderer
can someone help me why the "spine" on the model isn't rotating?
https://github.com/dzenis-zigo/2d-shooter-game
lmk if u want to help but downloading code is stupid (i have no idea)
I think I have to rotate in LateUpdate()
If you are using an animator, then yes. Either lateupdate or ik.
Is it possible to have two tilemaps? I want to use first for "ground" (so it has tilemap collider) and second for "background" (so it doesn't have tilemap collider)?
You can have two separate gameobjects with their own tilemap component
Or more
when making a 2d skeletal rig that holds various different weapons, would putting all weapon sprites in the pbs file that has character sprites be the right way, or would it be better to have weapons be a game object that's a child of the hands. and the weapons object will have a sprite resolver
or is there no right way
for what its worth im planning on implementing various weapon types with each having their own swappable palletes
If I'm packing together my sprites in sprite atlases (4096x4096), does it matter if the original texture sprites are random, various resolutions, for example npot?
because Unity is basically only loading in the sprite atlas into the game yeah? So it's pretty much "leaving" the raw texture files behind.
I'm pretty sure this is easy and/or there's a video that easily explains this. I just don't know what to look up. I want to put a sprite ontop of another and have it slowly fade in/out of the one it is against in the same animation. Does anyone know what that is or what I should google?
hi there, just wondering why the tiles in my tilemap appear so small?
fixed it, just had to make a new palette and add the assets one at a time
In the sprite editor you set the pixel size you want..
Hello, i am trying to get the height and width of a texture2D but unity always limits the texture to 2048x1024 although I changed the MaxSize in the settings of the Texture to 4096. Does anyone know why?
I wanna get the real resolution of the texture
Pixels Per Unit value in texture import settings is not matching your sprite resolution
The "Non-Power of 2" setting will still resize the texture if its dimensions aren't a power of two
Sliced sprites are often NPOT anyways so safe to assume it doesn't matter
Maybe have them under one animator which controls the alpha
Hard to say without knowing what it's for
Another question comes up in mind How can I Test my game on my android on iMac in unity? Is Therme anything ? And what do i need to do to make up a Good Quality of my game, so the graphics should bei Good tho
Probably something super simple but the preview for the pixel perfect camera shows my background filling the whole screen but when I hit play it zooms out and only fills a portion, what might be causing this?
Hey guys. I'm trying to make a dungeon generation system. I have different tilemaps as prefabs with rooms drawn on them. Will it be a problem to spawn multiple tilemaps in a scene? if it is a problem how would I make it so that it copies those tilemaps to a tilemap from prefab?
Ive recently started running into a rendering bug with my tiles. The first image is what my assets look like when implemented into unity, while the second image is what they should look like. My images are being rendered with a single sprite mode, and they are set to filter mode point. Any ideas on what is occurring?
Have you tried setting the compression to none?
I’m not sure if it will change anything but it might be worth a try
thank you!
that just fixed it
seems to be a facet of how unity reacts to low pixel objects
To answer this: yes, I fixed it, I did it manually
And to answer this: I did set the correct value
It just didn't like importing every image at once
Interesting to know that can have an effect as well
Yeah, I didn't even know why it happened honestly
If the question fits many channels, post it where it seems most relevant
If it isn't relevant after all you'll be directed elsewhere
If it takes a long time without anyone responding, you can post the question to another relevant channel for perhaps a different set of eyes on it
On the surface "2D animation" is both 2D and animation relevant
ok
anyone have any wood texturing examples? and also how I can make this window frame look better? Having a hard time trying to figure it out
When importing tilesets, the automatically generated physics shapes are always extruded off of surfaces, even when the sprite is extremely simple like this. Is there some setting you can change to fix this? I know you can manually set custom physics shapes, but this would save a lot of time and effort
hi, why my 2d texture has black things on the Unity editor but in paint.net it doesn't has them and also on the preview in the inspector ?
ok nevermind I found why, I just put a custom material on it that adds outline
how would i calculate the camera size to not get something like this?
the tiles are all the same but you can see the ones over to the right have the outlines more prominent
nvm ended up using pixel perfect camera and some other compromise
omg so when using 2d animation rigging, if you try to have a child of a sprite it wont get moved
and you can't change the sprite to something that isn't part of the psb file
what an awful system
and if you sprite swap a skinned sprite it won't transform based on the root bone
however if you sprite swap with a sprite from a completely unrelated skeleton it will work just because the sprite is associated with a bone
awful awful
@elfin sandal yeah. All problems I've complained about =p
more people should complain lol maybe they'll listen someday
but i found if i just go to skinning editor on a random sprite and place a bone on it then replacing sprites will work
so dumb that it has to be done that way
should just be able to use the pivot
Yeah
It is obnoxious, but it feels like whoever did the sprite swapping never tried using it with a real project
Another question comes up in mind How can I Test my game on my android on iMac in unity? Is Therme anything ? And what do i need to do to make up a Good Quality of my game, so the graphics should bei Good tho
Sprite atlas with your blocks will fix the lines..
I'd ask in #📱┃mobile
why are my tiles like this
Hey, im dragging a rule into the tile palette but i cant see the default sprite
However the Palette shows the prefab in the project window
Shouldnt the default sprite show?
here´s how the rule looks
I have a tile sheet where each tile is 32x32 pixels but when I try to slice it into individual tiles it slices each pixel. How do I slice the tile instead of each individual pixel of every tile?
You gave an empty state so it thinks that state should be empty.
sorry i dont see any empty state
Your first rule. No sprite there.
hey guys, anyone know where i can find a good pathfinding package for unity?
navmesh plus seems to be broekn
either that or my unity version is unsupported
Hey, i have a tilemap in which i got different tiles. I want to have a specific tag to my platform's tile, and a different tag for the ground's tile, is there a way to do that?
Hi, I'm using a 2D Texture sprite on a quad on the top face of a cube in a 3D game with URP. I have the quad's material set to transparent (this works) and I want to "paint" on the texture using SetPixel(r, g, b, a) in such a way that the paint is not transparent.
When I try to set per-pixel transparency (that is, a=1) in this way it has no effect at all, although the r,g,b values are adopted, and the alpha channel of the pixels is unaffected. Here's a picture of a test scene - the cube stripes should not be visible through the paint but they somehow are, although the (r,g,b) value of the paint is applied and obliterates the Unity logo on the right.
Here's my core splat function on the paintbrush. Can anyone see what I'm doing wrong?
private void RayCastSplat()
{
var rayStart = _splatRay.transform.position;
var rayDirection = _splatRay.transform.forward;
float rayLength = 1f;
RaycastHit hit;
if (!Physics.Raycast(rayStart, rayDirection, out hit, rayLength))
return;
Renderer rend = hit.transform.GetComponent<Renderer>();
MeshCollider meshCollider = hit.collider as MeshCollider;
if (rend == null
|| rend.sharedMaterial == null
|| rend.material.mainTexture == null
|| meshCollider == null)
return;
// texture has been cloned in Start to avoid messing up original
Texture2D tex = rend.material.mainTexture as Texture2D;
Vector2 pixelUV = hit.textureCoord;
var px = (int) (pixelUV.x * tex.width);
var py = (int) (pixelUV.y * tex.height);
// hopefully the compiler unwraps these loops (how to verify?)
var padding = 2;
for (int i = -padding; i <= padding; i++)
for (int j = -padding; j <= padding; j++)
tex.SetPixel(px + i, py + j, _color);
tex.Apply();
}
can someone explain why my texture does that ?
there a bit of overlap with the side texture
Is the material albedo alpha set to 1?
I think in 2021.3.14 the Albedo is called the Base Map; for the transparent Unity quad on the right, the Base Map is set up like this - the base colour is white, with alpha=0.5
I want the material to be semi-transparent but then I want to locally vary the actual alpha
Okay, the texture color does not override this value. It's multiplied by it, so you'll never get an opaque color with the base map color not being 1.
ah wow, ok, need to experiment some more with that, thanks
What you could do is edit your texture to be half transparent instead of changing the base map color. Then when you paint, your alpha would be the actual alpha.
interesting, thanks, haven't tried that - don't know how to do that actually but will find out. The texture is just a screen grab in windows (I think it was saved as a PNG file)
Png can store alpha values, so open it in any decent image editor and tweak the alpha.
I'm still concerned that this is what I'm doing already when I call .SetPixel on the texture. I understand that multiplying the alpha will clamp my observed alpha, so when I use a material with alpha 0.5 maybe I can't go outside a=[0,0.5] range but still would have expected the SetPixel call to do something ... I tried different values from 0 to 1 ... but anyway thanks for the input, will test.
So you say, setting different alpha values for _color doesn't change anything?
Does it not become completely transparent at 0?
correct, even zero, testing it now - I'd have thought with zero I'd make the pixels transparent
Okay. The settings seem to be fine. How do you set the _color value?
Although, do try disabling the mipmaps and see if it changes anything.
serialized in the inspector, so I can play with the alpha (testing mipmaps now)
disabling mipmaps didn't seem to help
Hmm
that's basically the same but with three paintbrushes all alpha=0.0 but color r,g,b
I wonder if this is some URP devilry
Well, I'm out of clues. If you want I could look at the project when I have some time. If so, upload it to GitHub or something and share the link.
thanks that's a very kind offer, let me see if I can figure it out but thankyou for your input
What's the material used for the overlay, and what's the (presumably a) render texture setup look like
dosen't work
Then presumably the problem is the padding you have set up in your sprite
i'm quite new so what's that ?
https://docs.unity3d.com/Manual/SpriteEditor.html the way you have presumably sliced your sprite.
If that's not it, you'll have to provide some more context about your setup
I went into a bit more detail up here:
#🖼️┃2d-tools message
but it's not a render texture; there's a 2D Texture applied to a material on a quad, which sits on top of the cube (the only purpose of the striped cube is to have something distinctive behind the quad so I can see variations in the alpha). The material on the quad is a 50% transparent Default type 2D texture; here are my complete settings and I haven't changed the code from what I posted above. So the puzzle is: if transparency is working for this setup, why can't I vary the per-pixel transparency of the texture using SetPixel(r,g,b,a)? Even setting a=0 seems to have no effect. But (r,g,b) does have an effect, that's how the paint is applied.
Basically if it was doing what I'd expect, at a=1 you would obscure the stripes on the cube in the background. and at a=0 you'd hide the Unity logo (by making it transparent) where you painted.
You have a lot going on and none of it is very clear to me which layer it's applying to.
Issues:
- Transparent is generally not good for anything other than glass. Often you want Fade instead.
- The color field next to the texture will multiply with the color values, including alpha, so if your other material also has that, it won't obsure anything.
- If the quad and the cube are both transparent, sorting will occur by the center of the objects, not via their actual depth. So it's likely at certain angles the cube renders above the quad.
- If you want to render something as 100% transparent and 100% opaque, use a cutout material (the material should be marked as opaque, and then it will sort properly)
OK, thanks for the suggestions...
- I only see Transparent & Opaque as options for this material
- The cube is opaque, I want to be able to vary the per-pixel opacity of the quad on top (with the Unity logo) which is 0.01 above the cube's top.
- a cutout material may be exactly what I want and I will look into that, thank you
Ah, it's Unlit. Transparent is fine, Cutout is ideal
If the above material is what you're using for the quad, then the issue is that you have 0.5 alpha, which is multiplied with your rgba values
again though, wouldn't you expect that if I apply a _colour value of (r,g,b,0) i.e. zero alpha, using SetPixel, that pixel should become transparent? Just an example
Yeah. I imagine the issue is that your original texture is imported as RGB8, as you can see in the preview window. If your original texture had transparency, that channel would probably exist, but seeing as it doesn't it's been stripped to save space
Ah now we might be getting somewhere - that might be the issue, or almost... I added an alpha channel using GIMP but that didn't quite work yet, I still can't adjust the alpha using SetPixel. Unfortunately I have to stop for the night but I have learned some stuff... I'm optimistic that I will fix this. Thanks for the discussion @hollow crown
- Just also make sure you've actually debugged the color value you're sending just to be sure something isn't totally borked
ok i'm out, it dosen't make any sense
WHY DOES IT CHANGE IT RANDOMLY
it's not even taking the tiles in
oml
@normal plumeare you using color or color32?
hi, I'm new to Photoshop and Unity and I was making the sprite (in pixel art I guess?) for my first 2D game. the problem is the file is 25x25 and it looks bad when put in Unity. how can I solve this?
Sprite sheets should be authored with padding and sliced with padding to prevent this issue
Generating a texture atlas has the option to generate padding as well, to avoid the effort of modifying the sprite sheets manually
sorry where is that setting? I'm in 2021.3.14
In your script, the color you are drawing.
They can be implicitly converted between but are very different.
For instance, an alpha of one would be solid for one and almost invisible in the other.
<@&502884371011731486>
!ban @dry ingot hacked account
Chocola#7774 was banned
I’m working with the pixel perfect camera and trying to work out resolution, why does (in game view) it appear cropped in 16:9 despite the fact that it is filled out in Full HD
To clarify I do have crop frame x and y enabled, I was just under the impression that it only cropped when outside a specific ratio and to the best of my knowledge 16:9 and full HD have the same ratio
how would i make it so the player cannot go into the water and only stay on the tilemap? as if the tilemap has a "hollow" collider
It's better to define collider tiles for the water
The collider tiles can be invisible if your water's texture doesn't come from the tilemap
(and as a bonus reusable anywhere)
I need character, anyone can help?
You can commission art online. Otherwise, this isn't the place to ask for free work if you can't find free stuff online.
Im kinda bored so I could do it for free. What are you looking for?
Btw does anyone know if you can use tilemaps for just a background?
Lemme show in dms
Hello everyone, I know I may sound like an absolute douche for asking this but I really need help on my new character design and I would appreciate if someone made 3 more textures for my character
My character is unfortunately 256x256 which is why it may be a pain
If anyone can help I would I appreciate it
If it's too much I will back down and do it myself as I know it is my model
!collab
We do not accept job or collab posts on discord.
Please use the forums:
• Commercial Job Seeking https://on.unity.com/jobseeking
• Commercial Job Offering https://on.unity.com/joboffering
• Non Commercial Collaboration https://on.unity.com/noncommercialcollab
Is there a way to make objects hide behind shadows?
Also how can I make a shadow shape out of a tilemap collider?
How to get Motion Blur working with Post Processing on 2D Sprites moving and a static camera? Builtin, Post Processing v2
With the unity tilemap is it possible to just fill tiles with a solid color instead of using a spite image?
And have it fill the whole tile, even if you resize the grid
no
when I try to getcategory() from sprite resolver it's returning null
actually my resolver's category is getting set to none as soon as the scene starts for some reason
but even if i set the category myself it gets reset
well, I can get the category at start and save it to a string
dumb as fuck that it has to be done this way
why when i export my pixel art it changes color and how to prevent that?
In import settings, choose point filter and set compression to none
ohh i forgot about the compression, thanks
Anyone know how I can change the offset of my tiles to give the illusion of animation here? Or if this is even possible? The water tile is perfectly tiled, so I figured this might be easier than actually doing it pixel by pixel.
That's something you'd do in the shader usually.
I suppose it was about time I got my feet wet with shaders
Another way to do it is to modify the transform.position (or transform.scale) of a tile. This changes the position (or size) of the sprite. But you'd have to do this for each tile position - or - you could have a custom tile class that wobbles the position (or size). But a shader is probably more efficient if it's a large number of tiles.
Hello I tried to make some tile pallets but for some reason when I paste in my sliced sprites the tile pallet shift everything on a diagonal
this happened a few times
idk what ive done wrong
Did you get this problem fixed?
Also what version of Unity you have running? Because I think this issue was fixed in Unity Verison 2020.1
There was a whole forum post about it here: https://forum.unity.com/threads/solved-weird-positioning-of-tiles-in-tile-pallette.508296/
using this version
and no I have not gotten it fixed but I will check this out
thank you
You're welcome and good luck.
how do i keep the background on the camera?
thank you i think it worked!
there was a fix in there
Make the background a child of the camera in the hierarchy is the easiest method. otherwise you have to do code.
wow that is so easy. Thank you so much!
should creating a sprite pallet literally take one second per split sprite
I think this is based on your system and the size of the sprite.. But I could be wrong.
i have a good system
and its of course a large sprite
i have a ryzen 9
laptop ryzen 9
Could be Unity bro, not 100% sure so I cannot really say for sure.
I have a hexagon tilemap; what equation could I use to get all the surrounding tiles at N distance?
Currently I have this function to get the adjacent tiles; but I need to be able to also get them for any given distance (not just distance = 1)
public static Vector2Int[] SurroundingTiles(Vector2Int tile, int distance = 1)
{
if (tile.y % 2 == 0)
{
return new Vector2Int[]
{
new(tile.x - 1, tile.y),
new(tile.x + 1, tile.y),
new(tile.x - 1, tile.y - 1),
new(tile.x, tile.y - 1),
new(tile.x - 1, tile.y + 1),
new(tile.x, tile.y + 1),
};
}
else
{
return new Vector2Int[]
{
new(tile.x - 1, tile.y),
new(tile.x + 1, tile.y),
new(tile.x + 1, tile.y - 1),
new(tile.x, tile.y - 1),
new(tile.x + 1, tile.y + 1),
new(tile.x, tile.y + 1),
};
}
}
There must be some mathematical way to do it, other than just doing function like this in multiple iterations.
I did..
you there?
Hello, I am testing the tile rule and I was wondering if it is possible to make two different types of tile rule interact as in my example image, with one side of stone and the other of earth (I wish they would stick).
I hope to be in the right place to ask ^^
I dragged in a sprite that wasn't the size of 1 cell and all my cells resized, how do I fix this?
ps this is the tile palette
Hi.
Can I crop sprite with mesh type full rect and sprite mode single and get new center?
Having the same issue.... LOL
change pixels per unit measure in the import settings of the image
I did, it's just that the ones I tried to drag in were larger than 1 cell yet still got shoved into 1 cell
Does anyone know of a way to take a sprite sheet png and automatically split it into separate png files. Not by tile size like slicing, but it cuts out the individual sprites? I have a large sprite sheet that is component based and doing it by hand is taking forever.
All of the individual sprites are different sizes.
Edit: In case anyone else is in need of this someone pointed me to https://github.com/ForkandBeard/Alferd-Spritesheet-Unpacker/releases
Works great so far on every sheet I've tested.
If you're looking for something free this website is dope https://www.pixilart.com/draw if you have an extra 16 bucks somewhere I would recommend to buy Aseprite
Scratch the website is would just download Krita
Personally, GIMP. Probably not the best tool, but it's what I use.
Thanks everyone! 😄
import times should not be 8 hours lmao
idk what's wrong
or how to fix it
Ye, something is definitely wrong.. Maybe ask in #💻┃unity-talk or one of the coding channels were more people look at the chat and see if you can get help..
I’ve tried to like 3 times now :(
Idk
Did you use google to see if you could anything online?
Seems to be decent info on this forum post
i like aseprite but its commercial software
Okay I will try this thank you
sadly did not help
alright my idea i said in the unitytalk chat worked i think
i just remove all other pallets while importing
!collab
We do not accept job or collab posts on discord.
Please use the forums:
• Commercial Job Seeking
• Commercial Job Offering
• Non Commercial Collaboration
!collab
We do not accept job or collab posts on discord.
Please use the forums:
• Commercial Job Seeking
• Commercial Job Offering
• Non Commercial Collaboration
How
What puzzles you?
That's what I was about to ask
would anyone have tips or advice how to draw an attack animation while also incorporating it into movement? i just cant figure out if i should draw a walk, walk-attack, and attack animations or just an attack animation, any help would be nice :]
This depends on subject and intended style
If "attack" means shooting a gun, you usually would have just a variant of movement states with a pointed gun
If it's a quick swing of a melee weapon, it could have leg movements that are brief and dynamic enough to work both for moving and standing
oh ok, thank you
You could describe in more detail how attacking works in your situation, but either way your best bet is looking at how other games with similar styles do it
i also asked help in another server and with your answer and theirs i think i have a grasp of how to do it, thank you
Another trick is to separate the upper and lower body animations to be able to re-use a lot of actions, even if they might look a bit stiff that way
Most games I can think of with long winded melee sequences don't allow the player to move during them
Idk where to put this, but is there a way to make a model invisible and only the texture? Making some sort of 2.5D
hello there friends! I've a question about pixel perfect game development. I was beaten by that last time I tried and focused on oher parts of game. However I do not want to delay this problem anymore - I've setup pixel perfect camera that is scrolling upwards constantly.
However, this makes weird jitter every several frames and I cannot figure out how to deal with this. Was looking for solutions on google, but could not find anything.
I've included movie how it looks like.
I have tried putting camera movement into lateupdate but it doesnt help. I could probably store camera position in separate field and round transform Y position to nearest 1/16 value (to match PPU) but I'm sure there must be a better, more correct way to do it.
you mean the jitter in the UI?
if I remember correctly the way I fixed it was by downloading a UI extension
forgot what it was called tho
does anyone know how to properly do a rule for diagonal tiles?
i want the top one to look like the bottom one
Diagonals and outer corners are interchangeable, you can't differentiate them with just tiling rules
The rules for the diagonal there seem incomplete, even if you think of it as an outer corner piece
crazy how I can't find anything about this when I look it up
You can always just manually place a tile too.
yeah, but if I wanted really long levels it'd take a long while
they always say dont reinvent the wheel
but apparently the wheel hasn't been invented for this problem
That's how you can become famous
Seems useful here
I know tilemapping techniques in general, but not Unity's systems so I can't give exact answers
It doesn't look like you've correctly filled in your rules
Its not the only combination i tried
I mean, this seems like an obvious omission
The way you have it set up, the first rule will always have priority.
Because you hit enter way too often?
what do you mean?
To be clear, is it a unity problem or aseprite?
I mean you used three lines and still managed not to say what you need help with?
Oh i thought it was sort of obvious. I exported the sprites on the Right, and when i drag them to unity they get
quite distorted
i was hoping to understand the reason.
I'm on mobile so they look identical to me. Probably your compression settings in unity.
where can i change them
Your compression settings in unity.
When yu inspect the sprite
Does anyone know what the best way to implement hazard tiles (like spikes) would be? In my previous project, I just put spikes on a separate tilemap and checked for collision with that but I'm wondering if there is a better solution?
I was thinking of using scriptable tiles though I'm not exactly sure how I'd implement it.
Okay, I decided on using a GameObject brush to get the advantages of grid snapping without having to deal with tile-related shenanigans.
i would make it so whenever the player collides with the tilemap collider it checks what tile is at that position and if the tile name is spikes then damage the player
There was some other stuff that I wanted to do that may not have been possible with a tile anyways so that's why I switched
👍
any tools to edit batches of images? I just want to change basic image properties like saturation, brightness and contrast and maybe vignette if possible?
nvm I downloaded an extension for gimp that does it^^
how is it, and what is the extension?
https://www.youtube.com/watch?v=K_GexKOdXmg&t=187s
This, though I havent really used it yet
How do i get the actual camera view to align with the pixel perfect green box?
Use a pixel perfect camera the same size as the box and put it in the same position?
for a tilebased game, how would I make a grid?
grid component?
but like what would I add the component to?
A game object
how would I make other objects move and scale by that grid?
easily googleable
I don't know if this is the right channel (I'm assuming it is), but you can see in the first picture there's a little sword that is to the right of the big sword. I did not put that there and it's not in the hierarchy, but it does have the same sprite as this prefab (second picture).
does anyone know why that little sword here
he's just standing there menacingly
also I can't click on it in the scene
I saved the project, restarted unity, and now it's gone
that was strange. If anyone does find an answer though it would be nice, cuz I am curious how the heck it got there
Hello, how can i give an npc a decided path to follow?
I need to give an npc a specific path to follow, which includes jumping and falling. I would need it not to follow the player, but to go direct. I was thinking about NAVMESH, but it follows the player. Advice?
Really an #🤖┃ai-navigation question but you can use pretty much any method, and just periodically update the goal position.
My slicing goes on very imprecisely, why is that? Here's like a 13x13 selection but you can see that there's only a little chunk in the left and a too big one on the right
I really didn't think it'd be this difficult but how does one create their own custom tiles? I got an asset package from the asset store but it's missing a regular black tile and I'd like to make it myself. What I've found online is for either scripted tiles or rule tiles
???? drag and drop the sprite onto a tile palette
My question should have been how to make a custom sprite then
What do you mean by custom sprite? It will have a custom texture
That's my tile palette
However I want a tile that's all black (same black those tiles)
And I can't figure out how to create one
Got it
And how can i do that?
You ask in the correct channel.
Does anybody know any good online softwares that are very good for creating 2d sprites?
I'm sorry, nobody does.
light2d, why's the yellow line flat? it's usually a full circle
not certain where to put this, but i feel it belongs here? I have discovered an odd quirk with the orthographic camera, it is that if an object has a higher y than the ones surrounding it, it gets given a black outline by some imperfection somewhere... Is there a workaround?
If alignment is slightly off or imperfect pixel per unit setting might allow bleed in from the border. Hard to say. Pixel perfect camera usually fixes looking through seams thing. But I've had it work without it with tilemaps as well.
ok thanks, i will look into that stuff then!
One workaround to fix it is to make tile slightly larger to cover bleed in. But ideally you could match it perfectly.
ooh, ill keep that in mind, thanks
ok pixel perfect camera did not fix it, but i cannot guarantee that i set it up properly
im probably going to have to do this, 1 or 2 pixels shouldn't be that noticeable hopefully
does the tile have any compression or antialiasing on the asset?
i dont think so, but the texture is 3 times the size of the other textures, with the tile being 3 times scaled on the x and z to give it the illusion of being a tall tree.. could that be the cause?
That looks like something under the tree bleeds in though not the tree itself
there isnt anything underneath the tree, with my current setup i can only have 1 tile per place
And that's a game view and you don't have any gizmos enabled?
as far as im aware
It frames exactly the tile under it
yep
don't seem to be related to the tree
the black border thingy is exactly where the transparency in the tree starts, hence why i would think it was the tree...
Yea, that looks like an asset artifact. Cleanup edges.
how would i cleanup the edges?
make sure you don't have semitransparent anything around it. You can see the top part of it is just fine
none of my sprites have anything semitransparent as far as i know, I'm quite a noob to drawing pixelated sprites so i've been sticking to either 100% or 0% opacity for all pixels
Right, you are scaling it and it is mismatched, the thing is not pixel perfect anyway, so make it larger to cover seams
ok, thanks so much!
you could also have background of the same color so it would help hiding it
ooh, like using a solid colour sky box?
Yes. Also you could have a second tile grid to separate tiles from trees, you'll have more freedom with their positioning
fascinating, ill keep that in mind, as that sounds cool, thanks a ton!
because you will have problem drawing object on that tile, they can't be sorted like this
that is if you want for something to appear in-front or behind the tree while standing anywhere near it
not quite certain what you mean there, but currently i use y to get things to render over or under eachother, which seems decent atleast for now lol
if you have a floor attached to a tree, you can't exactly draw something behind it, the floor will be drawn on top of it if you do
my tiles are all individual currently, they cannot be attached to eachother, but should that ever change ill keep that in mind
I'm currently trying to learn the 2D Sprite rigging. I have a question if you have a .PSB where you want multiple variations of a layer. (For example 10 different hair styles). I can use a Sprite Library and Sprite Resolver to switch out the sprite for the hair. The problem is that I have to rig every single hair sprite. (Even if it's copy and pasting the rig this is still a lot of work if you have a lot of different variations). Is there a way to do it while only making the rig once?
If you put all the layer variations into 1 PSB and do auto-weights this works ok, but the problem is if you need to weight paint...because it seems you can only weight paint one layer at a time?
nope, just a quirk of the system
bones need rigged sprites to move them so it can't be helped
whenever I make a tilemap, the tile is always bigger or smaller than the grid. How do i get around this??
Hey so I have this character
I am wanting to create a physics based tail for them rather than animating it by hand
There are 2 approaches to this that I'm considering:
- a code based approach, where I set the offset that each segment should have from the previous segment, and Lerp the value to create smooth movement. This is how Madeline's hair works in Celeste.
The drawback to this approach, is that I have to define alot of offset values that are not very intuitive to figure out initially. The advantage however is that I can have very direct control over the psuedo-physics here and not have to deal with blackbox unity components/systems, and I wont run into any unexpected behaviours.
- create some sort of spline, chain, link? I'm not sure what component to use exactly for this, but I know there is one that would suit this task perfectly. Disadvantage is that I have to control its behaviour through the component, which involves tweaking and fine tuning values, and depending on situations or behaviours I want, it could be very difficult to get it to behave the way I want.
The advantage to this approach is alot less initial work.
I'm just looking for others thoughts or opinions on this, or how you would do it if you could think of a different approach
There isn't really a good built in solution that would work similarly to that, unfortunately; there are a variety of options with their own benefits and drawbacks.
I do think there are components for this, like it wouldn't be much different than making a chain
Well, I suppose it depends on what you're doing. For instance, built in 2d physics don't play very well with animators, while spring bones need some script updating to get working since anima2d was depreciated. If you need squash/stretch rather than a rigid chain, that is an additional consideration.
I'm aware of animators vs physics. I dont use the animator for any of my movements, all of it is done via a 2D player controller on a kinematic rigidbody2d
hard coded psuedo physics
If the position of the tail's attachment point changes without inertia or teleports, such as when flipping the sprite or jumping, then a physics based system is likely to flip out
I think your best option is to code propagating motion on a chain of transforms, using something like this
https://youtu.be/9hTnlp9_wX8
There's many ways to make object chains depending on how it needs to work, and I can promise you'll be "tweaking and fine tuning" a lot regardless of the path you choose
After that you have the choice of representing the tail with multiple sprites or a line rendered along the tail points which is then pixelated in post
instant teleporting would cause issues with a physics based approach for sure, but I think this can be overcome by using code to clamp the max distance each segment can be from the last one. I expect fine tuning in any case, but getting it to work initially is going to be a task
in any case, I've been thinking on it all day, and I want to pursue the hard coded psuedo physics if I can get it to work.. that video you linked looks really relevant, and I'll give that a watch too
Ive also had a pixel perfect camera component on for a long time, but I'm finally considering taking it off, because the benefits it provides are starting to be outweighed by its drawbacks
and all the assets I've made are already to pixel scale anyways
Oh, and of course there is also the option to just draw six tail pose variation sprites and swap them based on the velocity 😄
I did it
even got a bit of code in there to control the tail wagging on running and idle states
I ended up going with the Celeste-like coding method
Looking good
Oh yeah, and that actually is one of the things that the built in 2d physics is bad at- changing character direction. The coded version makes quite a nice transition. 😄
I actually had trouble with that for the tail of my first character 😄
I want to detect what tile I click on using tilemaps. I can do this (pseudo):
//
//
tile = tileMap.GetTile(position);```
This way I can detect the tile I click on at the tileMap I assign from the inspector. But I have multiple tilemaps so I'm not sure how to detect it without assigning a tilemap first. Thanks in advance
I think you've got two approaches generally
- Detect the tilemaps under cursor first. I'd like to use OverlapPoint but since that doesn't return the results I think the option is a
Physics2D.Raycastcheck that's the length of zero or very short, then do GetTile only on the highest poisition Tilemap - Have all references to all Tilemaps to start with, do GetTile on a loop on all them sequentially that stops as soong as it finds a tile at that position
...
that makes perfectly sense
Thank you. I already have tilemap references, I'll give the second one a try
Anyone know how to export a level tilemap from one Unityproject to another?
My first attempt would be to make it a prefab, select the prefab and export as unitypackage with dependencies
When ever I import a sprite sheet everything gets corrupted, there will be blue splotches on the face and other splotches of colors, it's not the software I use or anything I checked various times so I think it's unity.. can anyone help?
It may be useful to show an example
It sounds like the usual texture compression artifacts though, which you can get rid of by setting compression to none
Ah ty I'll check that later
so I'm trying to programmatically make an isometric wall
and it works as a single layer, but if you do a dual layer (i.e. attempt to add height), it does this. I'm guessing its due to sort axis' and rendering order but I'm not sure. Does anyone know a workaround if there is one?
That is what it was!
anyone know a good tool for making 2d spritesheets?
I wanted to use paint.net but unity apparently struggles to read that format
ah okay so for anyone curious: I just needed to set sorting order thru the renderer, easy peasy!
use aseprite
Its the 2d art program, no lie. does animation even
Just export to png
yeah or png
asperite is pretty awesome still tho, its like 20 bux for a suite of tools that slap
Can unity use vector images?
can someone tell me what's going wrong here? I tried making the image to the right in photoshop, but when it was imported it became the image on the left.
Set filter mode to point, and compression to none in import setting for the image in unity
Piskel is a good free one that does animation and can export it as spritesheet
Nevermind, I love you more than that last guy
Thanx I`ll try that ..
is there a way to prevent placing sprites on top of each other using unity's tilemap?
💖
I also made this with Piskel and Unity
anyone know how to have a shadow caster 2d on a tilemap??
i can't see any sprites rendered in my scene view.
using latest unity 2023.1 beta and URP..
does anyone know how to fix this?
Make sure the sprites are not behind the camera.
how did you make this camera system
do you mean eliminating tears in the tilemap?
look into Pixel perfect camera scripts
Gaps in tilemap can be fixed by pixel perfect rendering
Gaps of color in tilemaps may be fixed by that as well, but the root cause is lack of padding between tiles on the sprite sheet
is it possible to make the shape of a shadow caster the same shape as a tilemap collider?
hey I have trouble understanding how do i set my game window to be exactly 320x180 in unity, cam anyone point me in some direction? I did set the game view to 16:9 but it'd like it to set it to the mentioned resolution so that it fits 40 tiles in width (Ive created 8x8 tiles). Am I missing anything or do I have to just manually resize the window to fit as many tiles as I want
How do i enable this pixel perfect rendering
https://docs.unity3d.com/Packages/com.unity.2d.pixel-perfect@5.0/manual/index.html It's a component from this package
If you're working with Cinemachine or URP, note that Cinemachine requires a vcam extension for it and URP requires the 2D renderer for it
Hm, i am watching a tutorial and for now i only added this pixel perfect component, but it upscales camera viewport
I should've given a heads up that pixel perfect rendering is not just a component that fixes problems, it's a workflow for constraining screen resolution, camera size and sprite PPU values all together
for ultimately producing pixel perfect results
i cannot fully understand what you are saying
english is not my native
What to do if i want the camera size to stay at 4.8? As soon as i click "Run In Edit Mode" in pixel perfect camera it changes to 4
There is no simple answer to that because it depends on pixel perfect camera's reference resolution
so i just need to test it?
I don't actually recommend using the pixel perfect camera if your goal is to just fix the color bleed between tiles
It's a good system for what it does but it takes a lot of learning and it has its limitations
If you only want to fix the color bleeding, then you need padding between tiles on the sprite sheet as I originally mentioned
How do i set that up
A. Modify the sprite sheet in an image editor so that each tile has 1 pixel of padding in each direction
or B. Generate a sprite atlas in Unity which has the option to add padding automatically
A sprite atlas is not really intended to fix this specific problem either, but incidentally helps
And it's not as complex as pixel perfect rendering
Where do i set the padding?
The sprite editor cannot do it
You need to modify the image itself in an external image editor, then slice it again in sprite editor
i thought you meant sprite editor as image editor
what do you mean by external image editor?
Inspector?
Its my first time working with 2d in unity
I mean not Unity at all, but an image editor like Gimp or Photoshop
Aseprite can do the operation automatically very easily but it's not free
Because of that generating a sprite atlas is probably the simplest way
https://docs.unity3d.com/Manual/class-SpriteAtlas.html
damn
orthographic camera strikes again, with a very large difference between scene view and game view... The shader i am using is one that allows me to have animated sprites, i would reckon that this is not the issue, due to the fact this issue does not occur on other animated sprites with the same shader. The skybox background is definitely black btw. It almost seems like the orthographic camera is not clearing the pixels, or something odd like that... Are there any workarounds?
ah discord compression has kinda ruined those screenshots.... the pink lines are much more visible than discord shows
Pretty weird issue. Have to narrow down the problem if it's a shader, or rendering pipeline maybe.
ye it is odd, and im not really certain how to narrow down the issue, but so far i reckon it might have something to do with the mesh? As for quads the lines appear on the left side of the tiles, but for cubes the lines appear on the right side of the tiles... weird
Narrow down by swapping shader, assets shader is using. If it happens in a specific configuration
can't really swap the shader, or else there is no issue, this is an animated texture where the issue is only present on the 2nd frame
doubt it is the shader though, or else changing mesh wouldn't affect it, atleast as far as i know
Maybe something off in that shader. Try leaving in only necessary parts to test it, no animation and swap manually to test
only minimal nodes
ok ill try that and report back!
just leave the sprite swapping node and feed index values manually to it.
Just to strip down to very basics and remove all possible interference.
Ok I've stripped it down to this and the issue still occurs, fascinating! Also upon unmaximising the shadergraph window i got this error.
Could possibly be a bug in Flipbook. What version Unity are you using?
2022.2.5f1
i doubt it is a bug in flipbook, cause why would a different mesh cause the issue to happen on the other side?
oh, does it happen if you use some base Unity sprites?
ooh i dont know, ill quickly check
or at least change the order of sprites
ill also check that then!
having it as black then pink gives me the same issue as having it pink then black, except now the line appears on the opposite side of the tile, in the same way that changing the mesh does
and using any unity sprite?
still trying to find a unity sprite, i remember finding tonnes always, but now i seemingly can't find any....
UI stuff has plenty
thanks ill check there then!
i remember there used to be a way to open up a window that would allow you to look through all textures in a project, unity and not unity, does this window still exist, is there a shortcut for it?
texture property on the material would open asset browser
aha that is how you access it! I always forget you have to create a new material to bring up the window!
Target button on the right of it
Oh, just realized it's not going to work, it needs atlas
what is an atlas?
Does your atlas asset uses any compression, filtering? Try turning that off, maybe bleeding in
An asset with several sprites
didn't know you could even do that lol, sounds cool
Aren't you passing atlas to the flip book?
ok turns out that it is really difficult to find a unity texture that would work to test this, as most are a solid colour throughout, and the ones that have different colours in each half usually have some sort of transparency around the edges...
no?
i dont pass any textures or anything to the flip book
i use the flipbook thing to sample the texture though
I mean yea, flipbook helps to walk through the atlas turning width and rows to simple indexes. I think.
So if you are not using an atlas you don't really need the flipbook
i don't know if im using an atlas or not lol... I don't think i am, but i might be accidentally using one
I think I've linked this already. Here you can see how sprite atlas dimensions are being set and atlas itself. https://youtu.be/gEnsciDtbUQ?t=132
I go over how to use Unity's Flipbook in the HDR Shader Graph. This will show you how to use your own sprite sheets to make animated textures for your own projects. You can use these steps to improve on the methods shown as I go over some of the basics.
No coding was used in the making of this video. I show how to animate the tile amount throu...
ok and ye I can't work out if this is affecting unity sprites or not
If you are not using atlas and just entering sprites that would cause anomalies
ye i tried to follow that, i think i did it somewhat well lol, I'll watch it again though
ye, i only enter 1 sprite
So either put them into atlas or just swap sprites without flipbook manually,
which do you reckon would be easier?
With flipbook you can create animation timer inside the shader and expose some controls. With regular shader you would animate like you previously did with coroutine.
in any image editor put then on a grid
oh, i might already be using an atlas then?
ok, from rewatching it seem I'm doing this basically the same, except that I'm using modulus instead of animation to control which tile to show
Make sure that atlas dimensions are setup correctly as well
width and height on flipbook
yup, 2 width, 1 height is correct
Also no compression or filtering, it may have been bleeding in. On the atlas asset
ye it has no compression or filtering:
It should have sprite mode multiple I think
ah ok I'll try that!
the problem persists sadly
then maybe leave it alone for now and do it with coroutine. You can detail the problem and post it on the forum, might get solved there.
Ok! Btw which forum, as there are 2 official unity forums, atleast as far as i know lol
💬 Have a question that requires a more detailed explanation? We suggest using the Unity forums https://forum.unity.com/ to ensure your question is answered more effectively.
thanks a ton!
🧑🏫 Unity Learn can offer you over 750 hours of free live and on-demand learning content for all levels of experience! Make sure to check it out at https://learn.unity.com/
Hello guys i am very new to unity and i wanted to ask how to check if a game object left the camera in a 2d game i tried googling it but i didnt find anything that worked for me can someone tell me how
?
make a check for the position, and make the gameobject destroy if it goes out of bounds
Also, i need some help, i need help creating an animation from the PNG frames. I drag all the frames, but it keeps flashing, and its not really smooth
Heyo, I'm trying out the 2D shadows with 2D-URP.
When the light I'm controlling with the point goes too far away from the object being lit in the scene, the object ignores all other lights too.
There shouldn't be anything different from the light I can control compared to the non-moving ones.
Is this some shadow-option I'm missing?
When you're importing sprites, is there some way to make them full squares when using a tilemap instead of using their custom physics shape? Here's my settings, which I had wrongly assumed were doing what I wanted 😦
(Mesh type being full rect and generation of physics shapes disabled)
No, it is just that their 2d shadows are terrible 😛
This is getting pretty annoying -- I can't view my rule tile in the tile palette, because I'm only using the gameobject property. If I do use the sprite property, the sprite doesn't disappear when the gameobject is removed in the game..
Is there some way around this? I am sick of losing track of it, and I'd rather not make a "YOUR RULE TILE IS RIGHT HERE" sprite in my tilemap, haha
At the moment I am thinking that each tile needs a reference to the tilemap it's on, and then deletes the tile in its cell when it is destroyed
Hi all! Can I ask for some help please 😅 When import a PSB into Unity. I have layers for each sprite frame. But Unity cuts away the empty space around my layers. How can I force Unity to use the entire layer instead of cutting out the sprite?....On the left is the photoshop layer, on the right is the cut out sprite in Unity.......Why this is a problem is because the pivot is now off, so the sprite is "jumping" around in the animation.
You can edit the pivot in unity
I know but I don't want to manually fix all the pivots, that's going to take a long time to get right
have you tried import mode: merged
or activate/deactivate automatic reslice in import settings
Hi! Thanks for the ideas! 😁 The automatic reslice doesn't seem to do anything. The merge one actually works to keep the spacing, but it throws all my layers on top of each other. So that's not going to work either.
Oof srry to hear that
I do recall flipbook animation being used with psb importer in a unity video tho
I forgot the timestamp but it was aunity presentation of the animation package
In this video, we show you Unity's PSD Importer and share some tips that may help you improve your 2D workflow!
Read the Blogpost for more Tips on how to Improve your 2D Workflow!
https://on.unity.com/3txCltt
And this one for even more tips on how to Optimize your 2D Workflow!
https://on.unity.com/2QdKGUF
Learn more about our 2D Tools here!
h...
If you're talking about this one. It's hard to see if his scene has the same problem. He doesn't mention or explain an option for it at all. Which makes me feel his scene has the same issue. Scratch that, his scene does actually have the same problem. You can see the bottom shadow of the butterfly hopping up and down.
Another comment proving the same problem.
Is there an official Unity person we could tag in this problem? Seems like a real issue.
Best place to do it would be forums
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
You mean here?
Thats unity answers
Forums is seperate
Theres a 2d dedicated section in the foums with a pinned thread about 2d features that the 2d devs are part of and check regularly
Awesome I did this, thanks!
Hi, I created a tile and imported into unity and the colours are a bit off
Image 1 is what it looks like in Aseprite and how it should look
Image 2 is what it looks like in Unity
is anyone able to help pls?
Disable texture compression in import settings
perfect, thanking you! 🙂
@spring crypt More of a #🖼️┃2d-tools question, the two main ways are to have a stack of multiple ortho cameras of different sizes for each layer, or to average an object's transform position with its start point and the camera's position to some proportion
A an object that inherits 100% of camera's position is virtually at infinite distance
at 0% it's in the foreground, 50% somewhere in between and at negative values it seems to pop out from the scene towards the camera
I see. That makes sense, thank you.
Another question I have that is bugging me, if you don't mind answering, is why is this character unable to render on top of everything else? I have tried literally everything but it just won't work lmao. Tried sorting layers, messing with the game objects z position, nothing works
Canvas by default is rendered on top of everything else, and uses vastly different units for scale
Here it seems you're attempting to bring your sprite character into the canvas image space
And the final one is, I don't quite understand the interaction between a canvas and a 2D camera here. Why is this camera white square space so small compared to the canvas? Should the camera adapt to the size of the canvas or is it the other way around where the canvas should adapt to the camera? I have a canvas here that is holding 2 background images with these settings (So that the images that are supposed to be parallaxed fit to the player's screen aspect ratio and resolution at all times)
Oh I see, so I should not be using a canvas for this? Or do I just change some settings around?
Think of sprites and canvas as entirely separate things for now
They exist in the same 3D space even if they're in a mode that doesn't let them interact
Canvas treats scene units as pixels, other gameobjects treat them as meters
Ohh I see, so these white squares that represent them visually inside the scene are just that, to make me aware that they exist there?
So what you want to do here is bring your character back into the view of the camera, and make it reasonably small again instead of hundreds of meters tall
Ahh, that makes sense.
I like to hide the canvas from the scene view using this eye icon next to the Canvas object when not editing it because it tends to get in the way
You should normally use the canvas only for UI and stuff that needs to be rendered on top
Could you help me understand why is it that the camera here when in the scene shows blue empty space as if it is looking at nothing at all, but when I switch into game view, it shows me the correct BG images?
Oh i see, that makes sense. Thank you! So whenever I want to place these background images for my game orr any game asset really, like the characters, ground and stuff like that, I want to place them inside the camera space and leave the canvas for like UI buttons or text that render on top of those images?
The scene view is seeing only the lower left corner of your canvas, so you can't see much
This is due to the unit difference
Generally yes
You absolutely can use canvas for background images, but the canvas needs to be in screen space - camera or world space mode, which changes quite a bit how it works
Canvas is meant for elements that adjust to changing screen size and aspect ratio, which is an useful feature but you can also get tangled up in those systems and end up with stretchy city backgrounds unless you know how to work with it
Yeah, that is exactly what I wanted to avoid to happen about having stretchy images. I want the images to adapt to the player's screen aspect ratio so lets say someone is running the game in an uncommon resolution/aspect ratio of idk 800 x 750 or something like that or on a wide screen monitor, so I'm trying to understand how the canvas works. but you helped me a lot already! Thank you ❤️
Canvas scaling and anchor points can take a while to wrap your head around so I recommend to stick to sprites in front of the camera when you can when starting out
I have this old demo about the kind of parallax systems we talked about initially
Not super elegant but may be useful
Let me know if it's broken or something
Alrighty <3. Just to make sure, this is what you meant before right, so now my canvas has my main camera set as the render camera and the canvas adjusts to the camera. But the character remains not being able to render on top of it
Sweet! Thank you so much. Appreciate that
Don't try to put sprites or other non-UI gameobjects into the Canvas hierarchy
Images and sprites use different sorting methods
In fact try to work without a canvas at all for now is what I'd suggest
Only add it in when you need icons for lives or score or such
Alright. Will do that, ty
Can anyone help me out here? I wanted to know why is it that when I press play on the game the camera is actually showing stuff that it should not be showing. I thought the only visible things whenever I pressed play would be the stuff inside the white camera square on the scene.
Why is it showing the bottom part on the game scene? 🤔
is it a perspective camera
You have a camera follow script that seems to be moving the camera significantly closer to the character than it is in your scene view.
I mean, that's a very basic script but it isn't broken. It is doing exactly what it is supposed to do.
Maybe you'd want to use transform.position.y instead of target so it won't follow on up/down axis
using UnityEngine;
using System.Collections;
public class SmoothFollow : MonoBehaviour {
public Camera cam;
public Transform[] targets;
public int targetIndex = 0;
public float height = 5.0f;
public float heightDamping = 2.0f;
public float horizontalDamping = .5f;
public float zoom = 10f;
public float zoomSpeed = 4f;
void Start()
{
if(cam == null){
cam = gameObject.GetComponent<Camera>();
}
}
void LateUpdate () {
if (targets[0]==null) return;
float wantedXpos = targets[targetIndex].position.x;
float wantedHeight = targets[targetIndex].position.y + height;
float currentXpos = transform.position.x;
float currentHeight = transform.position.y;
currentXpos = Mathf.Lerp(currentXpos, wantedXpos, horizontalDamping * Time.deltaTime);
currentHeight = Mathf.Lerp(currentHeight, wantedHeight, heightDamping * Time.deltaTime);
transform.position = new Vector3(currentXpos,currentHeight,transform.position.z);
if(cam){cam.orthographicSize = Mathf.Lerp(cam.orthographicSize, zoom, zoomSpeed * Time.deltaTime);}
}
}```
Or just use cinemachine 😄
Yeah someone else pointed this out to me LMAO didn't know that existed
That's the camera script from my first game and it can handle a lot
There is just too much stuff, haahaha. Is there some list around here with like "must have plugins" to just make life easier on usual game dev tasks?
Thank you ❤️
I think cinemachine is absolute overkill for most 2d games.
The main reason to use cinemachine would be if you need the collisions and stuff it can handle.
Mesh confiners and blends are quite nice
I agree though most of its features are designed specifically for 3D cameras
Well, my script handles blends pretty nicely 😄
It handles one type of blend, Cinemachine is great if you need more
Personally I'm not a big fan of the "accumulative" use of lerping, but I don't think it causes many problems
The main concern is that exponentially slowing camera motion can cause shimmer or jitter with pixel graphics
it has been 3 days with no reply to my forum post, is this normal?
Well yeah, it was designed for a non pixel art game before cinemachine or pixel perfect existed. 
ah, welp... thanks!
Especially if you aren't replying to a thread a dev is already watching.
i don't even know what threads are lol
Forum topics.
they sound familiar
Link your forum post?
Yeah, something fucky is going on there.
Is your camera facing the right direction?
pretty sure it is
Did you try turning off the rest of the crap in the scene? The rest of the 4.3k triangles the inspector says are in your scene?
it is randomly generated terrain, but i can lower the generation distance
2.2k triangles is the lowest i can go, with prefabs taking up most of them
with generation distance of 1 (1 block in all directions from the player), the pink lines still appear on those few generated blocks, odd
true, but it would be a real pain to have to bring the stuff back afterwards
i can't just create a new scene with only those weird blocks, cause I'm using ecs, and i have a ton of systems which are looking for things to be in the scene, and if they don't find it, they throw a whole bunch of errors
i suppose this could be an issue with however ecs does rendering? Then again this could be an issue with almost anything, and it is a bit of a nightmare to try narrow it down...
can't, SystemBases and ISystems run regardless of scene
See, this is all stuff you didn't list in your post and any of these things could be contributing to the problem.
wait im an idiot, shaders render in editor mode, so i dont need to do this in playmode, hold on while i try this!
good point, sorry lol, ill edit it
ok, great but very confusing news! It isn't specific to the orthographic camera, projection camera does this aswell, and it doesn't seem to matter if the cubes are gameobjects or not!
ok from lining up the scene camera as close to perfectly as i can, I can sort of see the pink lines in scene view!
looks like this oddness is near pixel perfect
I don't see how this is even a #🖼️┃2d-tools question, so no wonder nobody there is answering
welp it used to be a 2d question, it has evolved though, so now it isnt even 2d related lol
You also haven't even said what render pipeline you're using
scared to move channels though, cause i dont want the mods to get angry
oh urp, sorry my bad
I think that what you really need to do is try to figure out, if not what is causing it, at least what the problem actually is.
how though
And then you'll be able to write out a question that peeps can potentially help solve
Well, first of all try and actually describe your scene and what is going on in it, since I still have no idea.
Try the shader in a fresh project
Debug your meshes
ughhh, fresh projects take about an hour, my computer is not very fast lol
they are unity meshes though
bare minimum reproducible setup: get a sprite that is twice as wide as it is tall, have 1 half be black, the other half be pink, chuck it into a material using that shadergraph shader, then put it on a cube, on the very edge there will be pink lines
what are UVs?
...yeeeah, I think I am seeing the potential problem here
this is my first time doing a 2d game, I currently don't know much about shader lingo, sorry lol
UVs are the texture coordinates of the mesh.