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 spacelyjoe · May 31, 2014 at 05:19 PM · gameobjecttags

How would I add multiple gameobjects with different tags into one

 1SpawnPoints = GameObject.FindGameObjectsWithTag("topspawner");
     1SpawnPoints += GameObject.FindGameObjectsWithTag("bottomspawner");
     1SpawnPoints += GameObject.FindGameObjectsWithTag("leftspawner");
     1SpawnPoints += GameObject.FindGameObjectsWithTag("rightspawner");

so if I wanted to have certain spawnpoints for 1SpawnPoints then i made a seperate variables 2SpawnPoints where I wanted just top and bottom, how would I do that?

Comment
Add comment · Show 9
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 Jeff-Kesselman · May 31, 2014 at 05:25 PM 0
Share

Um, does that code even compile? What language is this and where is 1SpawnPoints defined?

avatar image spacelyjoe · May 31, 2014 at 05:29 PM 0
Share
 private GameObject[] 1SpawnPoints;
avatar image spacelyjoe · May 31, 2014 at 05:29 PM 0
Share

No it doesn't compile but I'm just trying to let you visualize what I want to do

avatar image Jeff-Kesselman · May 31, 2014 at 05:34 PM 0
Share

This is AWFULLY close to script-begging, which is not allowed in questions. However because its so $$anonymous$$imal I'll show you some code. But PLEASE go learn how C# works.

 private GameObject[] 2SpawnPoints = new GameObject[2];
 2SpawnPoints[0] = GameObject.FindGameObjectWithTag('topspawner");
 2SpawnPoints[1] = GameObject.FindGameObjectWithTag('bottomspawner");
 

This assumes there is only one object with the tag "topspawner" and one object with the tag "bottomspawner" in your scene. If there are more then it will only get the first of each.

avatar image Lo0NuhtiK · May 31, 2014 at 05:36 PM 0
Share

http://unity3d.com/learn/documentation

http://unity3d.com/learn/tutorials/modules/beginner/scripting

http://answers.unity3d.com/questions/148211/list-of-frequently-asked-beginners-questions.html

http://answers.unity3d.com/questions/12321/how-can-i-start-learning-unity-fast-list-of-tutori.html

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by meat5000 · May 31, 2014 at 07:01 PM

Firstly, please don't start a new question on the same topic if you don't get what you want in this one.

Secondly, try lists.

Its like an array that you can add to in a similar fashion to what you suggest in the Question.

I provided a link in the above comment.

Comment
Add comment · Show 2 · 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 spacelyjoe · May 31, 2014 at 07:30 PM 0
Share

A list won't work, it will give me the same error

avatar image meat5000 ♦ · May 31, 2014 at 07:32 PM 0
Share

Have you tried?

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

23 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

Related Questions

Destroying Multiple Objects with Tags 1 Answer

How to calculate Distances 2 Answers

How would I search my scene for a tag 1 Answer

Set reference to multiple gameobjects based on tag category / multiple tags? 2 Answers

Need a Custom array Index to look up gameobject tags? 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