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 /
  • Help Room /
avatar image
0
Question by kyliee08 · Sep 25, 2017 at 01:15 PM · if statementbegginergetmousebutton

I want to enable gameobject if i drop 2 gameobject in the same place so i create getmousebuttonup but i don't know how to create statement

public class grey : MonoBehaviour { public GameObject[] color;

 // Use this for initialization
 void Start () {

 }

 // Update is called once per frame
 void Update ()
 {
     if (gameObject.name== "black" && gameObject.name == "white") {
         if (Input.GetMouseButtonUp (0)) {
             for (int i = 0; i < color.Length; i++)
                 color [i].SetActive (true);
         }
     }
 }

}

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Cuttlas-U · Sep 25, 2017 at 05:50 PM

hi;

if i got u right i think u want to active an obejct if 2 other objects are at the same position ;

the idea here can be using a trigger or checking the positions;

i can help u with scripts but u put very simple detailes; give me some screen shots of your project or draw for me what u want to make so i can help u better; and i think your script wont work this way ;

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 kyliee08 · Sep 26, 2017 at 10:54 AM 0
Share

alt text

i want to drag 2 object . example black and white are dragged in the same position the the hidden object will be activated.. thanks for helping sir.

unity1.png (253.2 kB)
avatar image kyliee08 · Sep 26, 2017 at 03:34 PM 0
Share

alt text

i did oncollision but it's not working when i drag .

d.png (343.5 kB)
avatar image Cuttlas-U kyliee08 · Sep 27, 2017 at 10:11 AM 0
Share

hi again ; the collision u wrote has some problems ;

first u should use it for 2d like this :

  void OnCollisionEnter2D(Collision2D coll)


the one u are using is for 3d ;

then u should not check "IsTrigger" option if u want it to check the collision ; but u can do it with trigger its better i think ;

any way i think checking collision is not a good idea for this ;

tell me did u wrote the drag and drop script ?

how does it work ? i want to do some thing better here , some thing that works well not with collision ;

I saw your problem late here u can send me mail so i can awnser faster :

savajjad@gmail.com

good luck ;

avatar image
0

Answer by kyliee08 · Sep 27, 2017 at 12:00 PM

thankyou sir! i already sent an email on your account

Comment
Add comment · 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

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

115 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

Related Questions

If Time > 0.25s 1 Answer

Transform.position of object not the same as shown on the inspector 1 Answer

SceneManager.GetActiveScene "takes only '1' argument" problem 1 Answer

How would you shorten that piece of code? 3 Answers

Random.Range returns either 1 or 2 2 Answers


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