Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 /
avatar image
0
Question by NewJourney20 · Apr 15, 2021 at 09:10 PM · objectscenetagactivenext level

i want the player to match 5 items correctly before next scene appears.

i currently have scenes where the player needs to move the correct object to the drop zone before the next scene appears. now i want scenes where the player needs to move all 5 objects to the correct drop zones before the next scene button appears but i cant figure it out.

i dont know how to make a condition that all 5 objects need to be matched correctly first before the button for the next scene appears.

i use a tag on my object and when matched it activates the next scene button, so if i have 5 objects all using the same tag how do i delay the button from activiating till all the objects are in the drop zone, now the button appears after the first object is matched.

public class TriggerButton : MonoBehaviour { public GameObject Player;

 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.tag == "Player")
         if (Input.GetMouseButtonUp(0))
         {
             {
                 Player.gameObject.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

1 Reply

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

Answer by HellsHand · Apr 15, 2021 at 10:33 PM

Put this into the objects to be matched:

Object Script:

 public class MatchedObjects()
 {
     bool matched = false;
 
     public bool GetMatched()  //Sorry I forget, but there is a better get;set method but this works
     {
         return matched;
     }

     public void SetMatched()
     {
         matched = true;
     }
 }

Then you could use this in the script where you match an object:

 public void OnMatch()
 {
     GameObject[] matchedObjects = GameObject.FindGameObjectsWithTag("Tag");  //Get all objects that need to be matched
     foreach(GameObject matchObj in matchedObjects)  //Loop through each object
     {
         if(!matchObj.GetComponent<MatchObjects>().GetMatched())  //If an object doesn't match...
         {
             break;  //This will immediately leave the loop
         }
         ActivateButton();  //Generic method to activate your button, this will only occur if all tagged objects are matched
     }
 }

Finally wherever you are actually checking if your objects match, if they do:

 "Reference to Object".SetMatch(); //Whatever you use to reference the script for the matched objects
 OnMatch();  //Probably on Player I'd guess?  Not enough code for a complete answer sorry, but this should get you close, if not post the rest of your scripts and I can tell you where it can go.
Comment
Add comment · Show 1 · 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 NewJourney20 · Apr 18, 2021 at 07:29 AM 0
Share

thank you so much for your help, the last post worked, i deleted it by accident.

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

144 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

Related Questions

If GameObject with tags not on scene 1 Answer

Count >= then object tag becomes active 1 Answer

Como activar una animacion al hacer clic en un objeto (How to activate an animation when you click on an object) 1 Answer

How to transform scene object movement in multi player? 0 Answers

Activating Game Objects 3 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