I'm trying to play sprite animation in unity, it is playing but when ut is playing the animation is flickering
How to solve this issue
I had a sprite animation on layer 0 placed on top of a background sprite image and got the flickering as well.
Change the sprite "order in layer" property to 1 (and leave your background sprite set to "order in layer" zero.
Flashing went away.
I had same problem. I fixed mine by adjusting the sorting layer. The flickering is caused by overlapping sprite.
So, your post came up in the searches. I was having a similar issue. For me, the animation would play, but there was a couple of bad frames/sprites that would be there as far as 'in' the animation, but they just weren't showing on screen. I could click on the frame image and it would show, but during animation it would disappear, causing the flashes.
But, by having the pop-out animation window open that can play frame by frame, I could figure out where the flash was. (Again, everything appears correct. Double-checked that it was set up the same as all others.) If you also watch the inspector window with the object selected, you can see the name of each animation frame as it goes by. So I did the frame-by-frame and saw that in two spots it said 'Sprite Missing'.
I figured they were just corrupted so I deleted them. But, the problem was still there (indicating that it wasn't an image issue.) Surprisingly though, when I tried dragging just those two images back in, everything worked fine. Who knows why 🤷♂️
Anyway, mine at least was a simple fixed once I kind of figured out where the issue was at. so, hopefully this might help someone else out at some point.
Related
So I have been working on a game in Unity2D, and I was working on the tilemap. Sometime while this was happening, I realized suddenly that my game was weirdly zoomed in when I looked at it through the game view, and this was happening across the board for all of my scenes, not just the one I had been working on. I'm not sure what I could have possibly changed, as the aspect ratio is still set to free aspect in the drop-down menu. My scene also won't show up properly in the scene view either- unless I hide my canvas, I can't see my normal scene anymore even though sort orders haven't changed. I must have clicked something by mistake, but I'm not sure what. Does anyone have any suggestions on what caused this and how to fix it? I'm using Unity version 2019.4.11f1.
Fixed. I somehow clicked the "low resolution aspect ratios" box in that dropdown menu.
Firstly, I've built for the Quest and checked the Unity profiler - everything seems good.
The weird thing is, when I move my head from side to side I don't see any framerate drops in the profiler but I see a noticeable stutter/lag in the headset. When my head is still or even just rotating, everything looks great, there's no stutter at all.
This stutter only occurs when I'm close to my UI and moving my head. When my head is static or rotating, it's all good. If I move back from the UI, there's no stutter either.
I don't think that it's an issue with too complex geometry or materials, as surely this would show up as a framerate drop in the profiler. I'm guessing that the camera movement is causing some kind of frame mismatch which (for some weird reason) isn't showing up in the profiler.
Does anybody have any ideas as to what might be causing this?
Well, I found the issue after narrowing the issue down to a specific set of GameObjects. It seems that the issue was being caused by a custom 'Dissolve' shader I was using. After setting the shaders back to 'standard' the problem went away! Weird...
This happens if your game FPS is lower than the device refresh rate.
For example if the headset is displaying 90 frames per second and your game is only able to render 70 frames per second, the headset needs to reuse a rendered frame every few frames.
When the game doesn't provide a rendered frame in time the device will just take the last rendered "image" and adjust it to the changed headset position and rotation. If it's a rotation change only, you will not notice, because the headset can easily just rotate the last image. But if it's also movement, the device can't simulate the difference of movement of close objects versus far objects on the image, so if you are moving an object close to a camera (e.g. your hand), it will stay at the same position for two frames (every few frames), which will make it look like it's stuttering.
This issue only affects the Scene view, and it is not present in the Game view or when it is running.
Basically my map looks like this.
https://i.imgur.com/BBrKA5f.png
Zoomed Out
https://i.imgur.com/G8BuG8d.png
As you can see there are horizontal lines everywhere. The grid is turned off. They are mostly blue because underneath the grass tile on the sheet is the water tile. You can see under the left of the rock there is a yellowish line, this is because there is a sandy tile below it. The individual images from the Sprite editor look fine. No lines in them. As mentioned, this is only present in the scene view and doesn't affect the game so its not major. I would really like to see if this is possible to fix though as it is quite a pain to look at and design maps with. This issue is present on my PC, and both laptops so I don't think it's hardware related.
Tile palette images:
https://i.imgur.com/huNDlHy.png
https://i.imgur.com/uLwUpUM.png
I've tried adding them to an Atlas, checked for Point (no filter) and no compression. I'm at a loss. No one seems to know how to fix the issue and all my googling points me to bleed or tears in the actual game which is not the issue I am having.
Any help would be greatly appreciated and I will provide any additional information that is needed.
Thank you.
So after a few days of frustration and help from the Unity discord, I finally found an answer.
It turns out you want to disable Pixel Snap in your Shader component on your tilemap object. As soon as I did that all the lines in Scene View were gone.
Setting to change:
I am having this weird problem with my game menu when I use SKShapeNodes instead of SKSpriteNodes. The menu is basically a subclass of SKNode and just has different SkSpriteNodes as buttons, its pretty straight forward.
Recently I changed the SKSpriteNode buttons to SKShapeNodes because it gives me some extra benefits (rounded corners, strokes etc). However the problem now starts when the game menu is shown.
Basically if a press the "homeScreen/Main Menu" button in my game menu a scene transition happens to another SKScene. The issue is that when the scene transition finished I can briefly still see the SKShapeNode buttons for like 1-2 seconds and than they disappear. Sometimes its just the buttons, sometimes it is the menu also. It sort of looks like LCD screen burn.
Whats even weirder is that if I only use 1 SKShapeNode button and the others are SKSpriteNodes the effects is the same, all buttons briefly show after the scene transition.
Using only SkSpriteNodes and this does not happen. Changing the scene transition style seems to make no difference too.
Has anyone had the same problem or maybe know what could cause this?
Thanks for any help or support.
So after more reasearch it turns out that SKShapeNodes are notorious for memory leaks and performance issue. In my case I was simply using to many SKShapeNodes. Solution is to either reduce SKShapeNodes count or using alternatives such as SKSpritenode.
So I have a small problem with my camera in 2D view. I have a background sprite that serves just as it sounds, the background. My problem is, I need the camera view to take up the entire background. At the moment I can only get the camera to capture out to the sides of the background but it will not fully catch the top and bottoms of the background.
This poses a problem, it will cause me to have to make all of my following items in the project to be super short and fat.
Yes, I know this is probably a stupid issue on my part or an easy fix, but being new to Unity, I am unaware of how to deal with this problem.
Here is a snip of my issue http://imgur.com/pz1sg9B
As you can see, I cannot get the camera to reach the top and bottom of the background thus leaving me with super short and fat items.
Thank you in advance!
You have to change the Viewport Rect on the editor.
You can check out Unity3D Manual for more knowledge on Cameras in Unity3D.