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 Darkhour99 · Apr 18, 2012 at 02:43 PM · javascriptarrayrtsqueue

I have an array problem

I'm basically trying to create a sort of a line that will wait for the first triggered before moving on to the next.

If that didn't make sense, think of an RTS where you can queue your research and spawning on top of each other.

I have hashed together an idea I had using an array but it doesn't seem to work after the first trigger. Here's the code:

Okay, couldn't get the in forum code formatting to work, so here's a pastebin link

The array just stops working and registers any more strings for a only frame after the first action completes, effectively doing nothing.

Also, if my scripting is bad and makes your head hurt, I apologize, I still consider myself a novice and I've been too busy to find and do advanced tutorials. Bear with me.

Also, it seems very cumbersome to do it my way, so if you have any suggestions of other ways, I'm all ears. I can be flexible.

EDIT: I have tried several different setups with queue, every single one runs with no errors but doesn't work with the if statement. I don't know if it's my fault or unity. I have tried: using .Equals(object) inside of an if statement, .Equals(object) as a boolean, .Peek = object inside an if statment.

Comment
Add comment · Show 3
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 Jessy · Apr 18, 2012 at 05:05 PM 2
Share

The Array class is worthless for everything. I think Queue is what you're after. http://msdn.microsoft.com/en-us/library/7977ey2c.aspx

avatar image Darkhour99 · Apr 27, 2012 at 02:33 PM 0
Share

Seeing as how reposting isn't enjoyed by any community, I'm going to do my best to bump. I need an answer and will not close this question til I get this working. Queue works up until the first object needs to be called. Can't figure out what's wrong, because there isn't much documentation on unityscript queue. Here are some examples of my attempts: http://pastebin.com/CUauNYYT

avatar image Diablo · Apr 27, 2012 at 03:05 PM 0
Share

You can keep posting until you're blue in the face, but it's not going to do you any good... the question you have is a basic program$$anonymous$$g question, not a Unity question. You need to go back and read a c# or javascript book, because this is very basic program$$anonymous$$g.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Diablo · Apr 19, 2012 at 12:12 AM

Jessy is correct, what you need is a Queue. Queue's work on the FIFO (First In, First Out) principle, so you can keep queueing multiple things up and fetch things one at a time as you're ready.

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 Darkhour99 · Apr 19, 2012 at 01:52 PM 0
Share

Is there a javascript equivelant of queue? If so, do you know of any documnetation? I really don't want to learn C# at the moment, but I guess I will if I have to.

Edit: I figured the javascript grammar for it out, but it doesn't seem to function at all though. Still would like some documentation. i'm not really sure what I'm doing function wise...

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Having Multiple Controllable FPS Units Selected From A Singular RTS Mode? 0 Answers

What is a 2D Array? 3 Answers

"For"-Loop only works for final element in array 1 Answer

Javascript How to Activate/Deactivate GameObject Arrays 1 Answer

how do i make teams for a rts game 1 Answer


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