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
1
Question by keith alexander 1 · Mar 27, 2011 at 08:39 PM · prefabgridcube

Where do i put this script???

i got this script from the unity documentation and i dont know where to put it im working on a fps game.

for(var y = 0; y <gridY; y++) { for (var x=0;x<gridX;x++)

      var pos = Vector3 (x,0,y) * spacing;
      Instantiate(blockPrefab, pos, Quaternion.identity);

  }

}

Comment
Add comment
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

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Justin Warner · Mar 27, 2011 at 08:47 PM

http://docwiki.unity3d.com/uploads/Main/Scripting%20Tutorial.pdf

http://unity3d.com/support/documentation/ScriptReference/

http://www.scottpetrovic.com/blog/2009/07/unity-3d-part-3-basic-scripting-wexample-and-source/

Read, study, go over, and do all these about 5 more times. THEN, post on here. If you don't try at all and just copy and paste code like a script kiddie, then no one is going to help you. I repeat, NO ONE is going to help you, and if they do, than that sucks for them, because it's a waste. If you want people to give you the time of day, then you have to, at the least, try for your self first. So, I say, go through the first link. Then go through the third link. Now, go through the second link on all the major things, and learn a little bit before you just post random things for us to fix for you... The problem with the script you posted is something so minor, that you should be able to point out in a second. But to hell if I'm going to tell you, because if you took but 2 minutes of your own time to actually go through a script, you'd see it, you'd know how to create a script, and how to add it to a scene...

Comment
Add comment · Show 21 · 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 Statement · Mar 27, 2011 at 08:49 PM 1
Share

I think the biggest problem was that he wasn't able to figure out when to run it. When the game starts? When a rocket explodes? When Chuck Norris descend from the heavens? Beats me. Start looks like a place good as any :)

avatar image FLASHDENMARK · Mar 27, 2011 at 08:56 PM 1
Share

Friendly re$$anonymous$$der: Dont feed the trolls :)

avatar image FLASHDENMARK · Mar 27, 2011 at 08:59 PM 1
Share

Excuse my language, but that was FUC$$anonymous$$ING awesome :)

avatar image Justin Warner · Mar 27, 2011 at 09:02 PM 1
Share

Looks awesome Statement. And yeah... I can imagine him crashing his computer when he finally realizes how to do it, then we'll get about 30 posts a day asking why it's crashing, zzz. And yea... but you still want to help people, but I don't know, asking the same 5 questions in a row makes me not want to help him... So, that's why I'm done with him at least.

avatar image FLASHDENMARK · Mar 27, 2011 at 09:24 PM 1
Share

@ Justin Warner Now you are just messing with hes head, arent you? :)

Show more comments
avatar image
2

Answer by Statement · Mar 27, 2011 at 09:13 PM

Look it's evident you want to create a game based on the mechanics of minecraft. Google a bit and you shall find existing solutions (minecraft starter package). Seems this is all you need. Now go and learn.

Comment
Add comment · Show 4 · 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 Justin Warner · Mar 27, 2011 at 09:16 PM 1
Share

Nice find, didn't think that someone's done that.

avatar image Statement · Mar 27, 2011 at 09:30 PM 0
Share

I am not surprised. It seems every kid, granny and programmer want to create a $$anonymous$$ecraft clone. I enjoy it for the sheer replayability. It's a really nice foundation to build other gameplay upon.

avatar image Statement · Mar 27, 2011 at 09:31 PM 1
Share

Rumors have it Chuck Norris even is struggling to create his epic meta-templatized voxel engine. Block Norris.

avatar image Justin Warner · Mar 27, 2011 at 09:35 PM 0
Share

I wish I knew what meta-templatized voxel meant, but I can't say I do... I find the game rather dull and boring... But to each is their own... The problem with clones, is they'll never be as good as the original... But oh well, people'll never learn.

avatar image
1

Answer by Hr Mller · Apr 06, 2011 at 07:11 AM

Drag it to one of your game objects.

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

Answer by Statement · Mar 27, 2011 at 08:46 PM

"dont know where to put it"

Grow some hair and it'll become evident. :) Seriously though, neither do I. What is your intent?

"im working on a fps game"

It doesn't help a lot to guess where to put it.

var blockPrefab : GameObject; var gridX : int = 5; var gridY : int = 5; var spacing : float = 1;

function Start() { for(var y = 0; y < gridY; y++) { for (var x = 0; x < gridX; x++) { var pos = Vector3(x, 0, y) * spacing; Instantiate(blockPrefab, pos, Quaternion.identity); } } }

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 keith alexander 1 · Mar 27, 2011 at 08:49 PM 0
Share

im making a $$anonymous$$ecraft game so wat im trying to do is placing blocks beside eachother and stacking

avatar image Statement · Mar 27, 2011 at 08:52 PM 1
Share

Sorry, don't know how to do that.

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

1 Person is following this question.

avatar image

Related Questions

How to instantiate a prefab at mouse pos 1 Answer

Adding Imperfections? 1 Answer

Pre-Normalized cube model? 3 Answers

How to make an object/prefab choose between multiple given positions to spawn into? 1 Answer

Prefab not showing preview 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