Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 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
1
Question by maw0041 · Oct 04, 2019 at 09:14 PM · uicolliderbuttonjointsfixedjoint

Tree View List Problems

Hello,

I have 2D fixed joints on my UI buttons as shown below: alt text

I have extra code for the movement and stuff but in essence, each of these is in a 2d "train" using fixed joints. I don't understand though, why isn't Orange being moved down too since it's attached to blue, it's anchor is on blue? Shouldn't it be attached and moving when blue moves? Instead I get the picture below...

alt text

example2.png (4.2 kB)
example1.png (11.1 kB)
Comment
Add comment · Show 5
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 lgarczyn · Oct 04, 2019 at 11:42 PM 0
Share

I am not sure what you are trying to do. Joints? As in physics joints?

avatar image maw0041 lgarczyn · Oct 07, 2019 at 08:35 PM 0
Share

Yes. I am simply trying to make a train of UI so that when the UI position changes, the train pushes the contents downward.

avatar image maw0041 lgarczyn · Oct 07, 2019 at 08:36 PM 0
Share

alt text

selection-example.png (32.4 kB)
avatar image lgarczyn maw0041 · Oct 08, 2019 at 06:09 PM 0
Share

I'm sorry, I have not a single clue on what you are trying to do. A train? Do you mean a tree? But at least I can assure you of one thing, if you are using physics elements in a UI system, you are probably doing something very wrong somewhere

avatar image maw0041 · Oct 08, 2019 at 06:18 PM 0
Share

I am just trying to get dropdown lists that move the contents below it down when I press the arrow. There is literally nothing anywhere that shows me how to do this... The ways I was doing it before were the worst... by manually moving down the contents' transforms... and that was so stupid and didn't even work. I just want when I press a dropdown arrow, the contents of the thing display and move the rest of the list down.

2 Replies

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

Answer by lgarczyn · Oct 08, 2019 at 08:51 PM

So there are a few solutions for this. Basically whatever you are trying to do with physics is a terrible idea and won't work.

You keep using the word train, but I have never heard of the word train to describe a foldable list. This is a tree view, not train.

What you want is that each node of your tree be able to calculate its height, kinda like this:

  float GetHeight() 
  {
      if (closed)
           return (self_height);
      else
      {
           float height = self_height;
           foreach (var child in children)
                 height += child.GetHeight();
           return (height);
       }
 }

Now you can calculate the position of any element.

But realistically, just use one of the dozen tree view package:

https://assetstore.unity.com/?q=Ui%20Tree&orderBy=0

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 maw0041 · Oct 09, 2019 at 07:42 PM 1
Share

Holy crap all I needed was the term "tree view" and all my problems are solved. I didn't know what to call the dang thing... I have been working on this for two weeks and kept googling "dynamic dropdown list" and "dropdown list that pushes the contents below it down" and there was just no help for that... Finally my suffering can partially end... I originally had hard coded a method to literally just move everything down 30 and then move it back up 30. IT was so bad. Then the desperate attempt to figure it out lead me to fixed joints. I know it was stupid but I literally had no idea how to figure out what I needed to do. Tree view!!!!!!!!!!!!!!!

avatar image maw0041 · Oct 18, 2019 at 07:17 PM 0
Share

So... I have been trying to use this code for a bit. What I am trying to do now is to put this script on each button that I have so that they will all display properly. It is throwing errors at me.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 
 public class Heights : $$anonymous$$onoBehaviour
 {
     public RawImage right;
     public RawImage down;
 
     public Vector2 position = new Vector2(0.5f, 0.5f);
     public float height;
 
 
     public float GetHeight()
     {
         position = gameObject.transform.position;
         height = position.y;
 
         if (right.gameObject.activeInHierarchy.Equals(true))                       // if the arrow is facing right, don't do anything
             {
                 return height;
             }
         else
             {
                 foreach (Transform child in transform)
                     height += child.GetHeight();
                 return height;
             }
     }
 }
avatar image lgarczyn maw0041 · Oct 19, 2019 at 10:51 PM 0
Share

I can't help you unless you give me the errors. Also, please use a Boolean to store the state of the object, ins$$anonymous$$d of getting it's state from the active status.

avatar image
1

Answer by muzammilshahiddevhouse · Sep 20, 2021 at 10:26 AM

@maw0041 https://www.youtube.com/watch?v=8uLSGlNQHo0 Bro just follow the link it has expandable menu tutorial.

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

225 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image 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

Detect only UI button click 3 Answers

How to make it so only a certain section of a button will work on click 1 Answer

How to highlight a selected inventory slot. 0 Answers

UI image with collider doesn't work OnMouseDown 1 Answer

Adding a function to a UI 4.6 Button called on another game object in c# 0 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