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 /
This question was closed Aug 04, 2013 at 11:43 PM by robertbu for the following reason:

Don't write code to spec.

avatar image
0
Question by AlienClubrider · Aug 04, 2013 at 11:19 PM ·

How do I get cubes to spawn in rows?

I can spawn cubes by pressing the space button but I want the cubes to come down in rows and without me pressing the space button.

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 cdrandin · Aug 04, 2013 at 11:41 PM 0
Share

So you want the cubes to fall in a row and just press the space button and have the cubes fall down, right?

First, you need to define where you want these objects to fall. It depends where in space you are look at to define your row. SO, pick an axis. Then, create objects and add to them a rigidbody, which gives them physics to allow them to fall. Then just align them away from each other depending on their dimensions. Only allow the continuous creating of cubes when the player has pressed "space".

Some notes: you will want to destroy objects eventually or else it creates unwanted game objects or simply too many.

avatar image robertbu · Aug 04, 2013 at 11:42 PM 0
Share

Unity Answers helps you solve your own problem, not write code for you. The solution to your problem is to write a nested 'for()' loop, and has little to do with Unity. Research nested loops, and make a try at the code. If you get stuck, post back your attempt as a new question.

avatar image AlienClubrider · Aug 05, 2013 at 12:47 AM 0
Share

No, I just want some to fall down in rows with out pressing any button.

1 Reply

  • Sort: 
avatar image
0

Answer by voporak5 · Aug 05, 2013 at 03:27 AM

That's what he is saying. So what I would do is A, the For Loop. Or B, I would have a 2 Variables. 1 Variable would Count and 1 Variable would act as my constant. When Variable A reaches Variable B (The Constant), then I would reset Variable A back to 0 and then Instantiate my object. Try writing stuff out on paper to figure out the logic.

Also, don't close your Questions when they aren't resolved. I almost didn't look at this because it said [Closed]. I only checked because I was curious otherwise I could have cared less.

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

Follow this Question

Answers Answers and Comments

15 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

Related Questions

What would the code look like if I want to spawn cubes of different color every spawn? 1 Answer

How to make spawn parameters 0 Answers

Delaying Spawning a Object 2 Answers

IndexOutOfRangeException: Array index is out of range. 0 Answers

how do i spawn an object x units from a hit in the racyastHit normal's direction 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