The tilemap covers the floating text UNITY 2D - unity3d

So I want to display a floating text everytime the player opens a chest, that indicates how many coins you earned. I created the level using tilemaps. The problem arises when I created the floating text, basically it's covered by the tilemap, because if I move it out of the level I can see it, otherwise not. I tried fixing this problem by using layers, but I can't manage to make it work. Does anyone know how to help me?
As you can see by the foto the outline of the text is visible, but in play mode you can't see it.

You should probably use the order in layer in the tilemap renderer and set it to a negative value.Im sorry if it doesnt work I am new to unity.

Related

Sprite dislplays all of the frames without acting like an actual sprite

So, i've been trying to make a videogame on unity, and i made my first sprite on piskel. Exported it as PNG but can't seem to make it work on Unity. I imported it as a new sprite and even selected sprite (2D and user UI) on the menu.I selected 2D sprite but it doesn't work. It's just like if I put an image there, and not a sprite.It stays still I even tried using another sprite format More rows
I can't find anyone else with the same problem out there on the internet, so help would be much appreciated. Thank you.
Selecting 2D sprite isn't the full story. You will also need to make the sprite "multiple" instead of "single" and split it up in the editor (now available in the package manager).
That will split it up into frames for you, then you drag and drop a single frame.
https://docs.unity3d.com/Manual/SpriteEditor.html

Experiencing a strange tile rendering bug in Unity's Scene view

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:

Trail Render not become visible during game play

I was working on simple 2d game and in that at player end, I want to attach trail effect. So I have added trail renderer component by creating child empty gameobject.
Also I have set proper trail rendering order as well. Here are more details with images so please check these:
Actual trail get drawn but not visible on game or in scene area.
Here is the component values those I set for trail renderer:
Now I hope you got my point so please share your suggestion regarding this.
Thank you for giving time for this question :)
Trail Renderer more details:
Player more details:
Gameplay more details:
Actually game play remain at same location, just I am dragging player ball through mouse so no rotation get included.
Still if you need more information then you can ask for that I will provide those as fast as possible.
I have solved this problem after doing some tries. Here I am posting an answer so this become useful to other members.
I require to set Material type to Mobile/Particles then after it become visible within game play. Though sorting order related setting is necessary that I was did before. But material related settings I don't knew before.

How I fix my character into center of camera with unity 3d

I need a solution for my problem, please.
I make a character in unity 3d base on AR, the problem is when I build the project in my android phone I can found the character or I should to turn a camera for search where is he.
I need to make this object into the center of my camera how can I do this, please ...
The question isn't the clearest, but I suggest attaching the camera to the gameobject you want to see in the editor.
This link is to a unity tutorial.
https://unity3d.com/learn/tutorials/projects/2d-ufo-tutorial/following-player-camera
Just re-read your question, AR skimed over that at first ... so you dont want to move the camera rather you want to move the object.
To find the middle of the screen in world space is what you asking for.
Camera.current.ViewportToWorldPoint(new Vector3(0.5f,0.5f, 100));
Use your camera to find a point in the world that is in the middle of your view. You have several options, ViewportToWorldPoint for example as shown above. ViewPort calls 0.5,0.5 the middle of the screen, Z is the distance from the Camera origin point.
You could alternativly cast a ray from your camera center screen and find a point on the ground to put your character at ... would need to know more about your wourld set up to help further.
My old answer is how to move a camera ... I will leave it case its useful to you.
[Edit Old Answer]
The other answer will work and is nice and light but has its limitations as your project advances.
I recomend Cinemachine for camera work, in this case a simple Cinemachine virtual camera setting its 'Look At' and optionaly its 'Follow' is what you want.
https://unity3d.com/learn/tutorials/topics/animation/using-cinemachine-getting-started
Cinemachine tutorail above. in short, Cinemachine works with the concept of 'virtual cameras' these are just light easy to use behvaiours that discribe how to 'frame' a shot e.g. what to look at, how to move, etc.
You real camera will get a Cinemachine 'brain' which simply listens to these virtual cameras and sorts out what to do to the real camera to make it happen. Getting to terms with this system will greatly improve your camera work and masivly simplify it.
Things like simply attaching the camera to the player object and similar work but have big limitations that end up biting you in the backside eventually.
Alternativly you can write a script to transform the camera based on your own custom logic the draw back here is the 'ball of code' problem ... that is at first the logic is simple but as you want more and more specific shots framed up it gets to being a spegettie monster quickly.

Textures to Object in Unity / Vuforia

I'm trying to do some Augmented Reality in Unity using the Vuforia plugin. I've managed to get everything working (I'm using a 3d model of a car), only the position of the car relative to the marker is wrong when I come to preview it (click the 'Play button at the top and watch through the computer's camera - is 'preview' the right name for this?).
It should be sitting on the the marker in the center, but instead it's floating above the marker and off to the side by quite a bit. The positioning is definitely right in the program itself, so I'm not sure why this isn't reflected in the preview.
Also: at the moment the car is simply an untextured grey object. I realise the textures are included in a subfolder, however I can't drag the entire car's folder (including the Textures subfolder) into the ImageTarget, only the .3ds file itself. Does anyone know how to apply the original textures to the car?
Thanks so much for your help in advance!
Ben
Well, to start answering your question about the drifting away part, you've probably got a Rigidbody attached to your Car? Well, if that's the case, then Go to the Inspector where the Rigidbody is and you'll see constraints.
To avoid it floating off, you might want to check Freeze Positions for whichever direction it needs. Probably Y axis.
Now, I'm not entirely sure if you're using Vector.AddForce to move your objects, but if you are then just check if your car can move if you've put all constraints on.
If you can't then in your code trying using Object.Rigidbody.SetActive(true) when you need it to start moving, and Object.Rigidbody.SetActive(false) when its done.
On the other hand, if you aren't using Vector.AddForce() then remove Rigidbody component if you've used it.
As for the material. If you've got the material in your folder that you've downloaded then just drag and drop it into Assets. Now sometimes your car may be one solid mesh, but some times it may be multiple meshes. So which ever the case. Drag the material from your Assets onto the Hierarchy panel over your car mesh/meshes and it should turn into that color.
Hope it helps. :)