- Home /
not sure how to use 2d sprites for my problem.
Hi there I am currently building an app where you can have a picture or a background of a house that can have all individual walls/components turned into a different colour or material when you touch them. Like if I drag a red colour to the door it will turn red or whatever the case might be. However, I am stuck on learning how sprites work. I'm getting to the point where I think sprites may not be the way to go. I currently have a sprite that spawns a massive texture when built and I can change the texture when touching the green square. the problem is the I can't see it in the editor so I have to build it every minor change which is frustrating me and not good with dozens of sprites that all need to be lined up. am I just understanding this all wrong or am I super close??? any advice will be appreciated!
Answer by MartinTV · Dec 05, 2018 at 06:17 AM
Do the sprites get set when you play in editor or is it solely in builds?
If it works in editor then I would say the issue is you're not supplying a default sprite until you play the game. You can solve this by dragging a sprite into the correct area of the SpriteRenderer component as I have on my project.
Hi there, yea I have tried that but the sprite always goes to 20X the size of the sprite box in the editor and then gets overridden in the build as I have CS code saying to set a certain sprite upon launch. I have just discovered tilemaps and they seem to maybe do what I want but with me not being an artist It may be a bit of a challenge. I'm thinking I need tiles for the frame of the house and other ones for the walls and doors etc. This way I can touch a tile with a tag and change all tagged tiles in the game.
If the image is 20x the size of the collider then I would say you need to open up photoshop and change the actual size of the image. There are some settings to tell Unity that an image that is 256x256 is equivalent to 1 unit squared but I can't remember where exactly that is. I think by default an image that is 64x64 is 1 unit square for unity.
Your answer
Follow this Question
Related Questions
confusion with sprites. 0 Answers
Android 2D Character Controller 2 Answers
My sprite from sprite.create looks pixelated. 1 Answer
Distribute terrain in zones 3 Answers
Can not retrive image form device to the plane at runtime. 0 Answers