Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 dee7800 · May 21, 2014 at 06:18 PM · modeltagmultipletagsautomate

How to assign a tag to multiple parts of a Model

In designing my race car game, i Designed the track pieces in a modeling program, then i also constructed the track in the modeling program because it was easier to snap the pieces together properly there rather than in the scene. when i import the track each section (track piece) has its own group or child object. So in the hierarchy it looks something like this (">" represents a collapse in the hierarchy):

track

  group_0  (entire track)

      group_1 (a track piece)
         > group_2 (road section)
           group_3 (one grass section)
           group_4 (other grass section)


     > group_5   (a track piece)
     > group_9   (a track piece)
     > group_13  (a track piece)

  .
  .
  .
   

after group 20 is reached the numbering is less predictable for example:

     >group_47
     >group_48
     >group_49
     >group_53
     >group_54
     group_55
         >group_6 5 (road section)
          group_7 5 (grass section)
          group_8 5 (grass section)


the road section break down further, but isn't very relevant because the the entire road section (ex. group_6 5) should be tagged as "road". But to show the complete structure it looks like:

          group_6 5 (road section)
               ID941 (left side of road)
               ID947 (center line of road)  ... (right side of road doesn't have its own child like the other pieces do)


the entire track consist of 57 track pieces. each trace piece needs to have the one "road" tag (consistently the first listed child) and two "grass" tags (consistently the second and third child listed).

The question is, is there a way to cycle/loop through the object/track's pieces and assign the tags, rather than manually selecting each component and assigning the tag?

Comment
Add comment · Show 2
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 roojerry · May 21, 2014 at 06:37 PM 0
Share

In the time it took you to write this question/get it answered, I am sure you could have multi selected and tagged all the objects you needed. The na$$anonymous$$g scheme doesn't help trying to use GameObject.Find. $$anonymous$$aybe, if road sections and grass sections had unique components on them, you could use Object.FindObjectsOfType to get lists of all objects and then tag them.

Otherwise, unless you think you will reuse this kind of function multiple times, I would say just brute force it to save time. Next time, maybe use a better na$$anonymous$$g scheme where you could loop through with GameObject.Find("grass1a"), GameObject.Find("grass1b"), GameObject.Find("grass2a"), etc...

avatar image dee7800 · May 21, 2014 at 07:02 PM 0
Share

this is just the first track, and in the interest of learning i ask the question. The na$$anonymous$$g scheme was generated automatically, but that would be something to look at back on in the modeling program to see if i can put in control over that. If so then it may help. Thanks for the comment.

0 Replies

· Add your reply
  • Sort: 

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

21 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

Related Questions

How do I affect every object with a certain tag? 0 Answers

Can't get more than one object. 1 Answer

A way to place many models into a neat row at once? 1 Answer

Tagging a prefab breaks my code? 0 Answers

MMD How to export model and animations to Unity as 3rd person controller? 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