Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
This question was closed Apr 23, 2020 at 05:25 PM by MustiKe for the following reason:

Problem tekrarlanabilir veya güncel değil

avatar image
0
Question by MustiKe · Apr 15, 2020 at 02:17 PM · spriteunity 2dchangespriterenderer

Object sprite changes

Hello guys I am working on a project but I have a little problem (I'm newbie).I want it to check whether there is soil on the lawn, if there is any, I want the soil to turn into grass, and in its grass to soil.Can someone help how to do it? (My English is not good sorry)

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

  • Sort: 
avatar image
0

Answer by Quickz · Apr 15, 2020 at 03:26 PM

You can try using Physics.OverlapBox/Physics2D.OverlapBox method to get all colliders in a certain region, let's say the lawn. Then you can iterate through those colliders and check which ones have a soil component.

Here are a few references you might find useful: https://docs.unity3d.com/ScriptReference/Physics.BoxCast.html https://docs.unity3d.com/ScriptReference/Physics2D.OverlapBox.html https://docs.unity3d.com/ScriptReference/GameObject.GetComponent.html https://docs.unity3d.com/ScriptReference/Object.Instantiate.html https://docs.unity3d.com/ScriptReference/Object.Destroy.html

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MustiKe · Apr 15, 2020 at 06:52 PM 0
Share

is there any tutorial videos of that because I need to see an example and thanks for the help.

avatar image Quickz MustiKe · Apr 15, 2020 at 08:17 PM 0
Share

Regarding tutorials, I don't have a specific one in $$anonymous$$d to give you. You can try checking out these two channels if you want to. They might have some learning material:
https://www.youtube.com/user/Brackeys
https://www.youtube.com/user/Unity3D/

About examples, I cooked one up. You can try playing around with it and adapt it to your needs. I would however suggest to check the Unity documentation out since they often have various small examples for individual methods that are available in the engine.
Preview: https://drive.google.com/file/d/11wcB8gAOLKKg61bwz-vBsfbXvryz2zF0/view
Project .unitypackage: https://drive.google.com/file/d/1wJPEdT$$anonymous$$446pOS_IxkmnAsDrxuZqqQkY7/view

avatar image MustiKe Quickz · Apr 17, 2020 at 07:25 PM 0
Share

These are 3D versions, my game is 2D and sandbox. I was thinking its a $$anonymous$$or problem and people easily help me.If you played $$anonymous$$ecraft before, you will see dirts become grass after few $$anonymous$$utes, thats what I want to do in 2D...

and after that, check top of the grass, if there is a block, change grass sprite to dirt sprite.

thanks for helping

Follow this Question

Answers Answers and Comments

170 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

keep sprite same size when changing 1 Answer

How to change sprite only on click or during shoot state? 1 Answer

Unity Game View won't refresh my sprites 1 Answer

Change a sprite during the game- JS 1 Answer

Flipping sprite by y axis when rotated past a certain point., 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges