• 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 /
  • Help Room /
avatar image
0
Question by Hadi_makes_games · Jun 12, 2020 at 02:19 PM · tetris

7 bag tetris not working

its not spawning my code is

 using UnityEngine;
 using System.Collections;
 
 
  string GetRandomTetromino ()
      {
  
          if (IUsed == true && LUsed == true && JUsed == true && OUsed == true && SUsed == true && ZUsed == true && TUsed == true) {
  
              IUsed = false;
              LUsed = false;
              JUsed = false;
              OUsed = false;
              SUsed = false;
              ZUsed = false;
              TUsed = false;
  
          }
  
          int randomTetromino = Random.Range(1, 8);
  
          // This string is used to define the location of the next Tetromino.
          string randomTetrominoName = "Prefabs/J";
  
  
  
          // This switch is used to get a random Tetromino out of 7.
          // NOTE: This needs to be modified to have a 7-bag randomiser later.
          switch (randomTetromino)
          {
  
              case 1:
                  if (TUsed == false) {
                      randomTetrominoName = "Prefabs/T";
                      TUsed = true;
                      
                  }
  
                  break;
  
              case 2:
                  if (SUsed == false) {
                      randomTetrominoName = "Prefabs/S";
                      SUsed = true;
                      
                  }
  
                  break;
  
              case 3:
                  if (LUsed == false) {
                      randomTetrominoName = "Prefabs/L";
                      LUsed = true;
                      
                  }
  
                  break;
  
              case 4:
                  if (JUsed == false) {
                      randomTetrominoName = "Prefabs/J";
                      JUsed = true;
                      
                  }
  
                  break;
  
              case 5:
                  if (IUsed == false) {
                      randomTetrominoName = "Prefabs/I";
                      IUsed = true;
                      
                  }
  
                  break;
  
              case 6:
                  if (ZUsed == false) {
                      randomTetrominoName = "Prefabs/Z";
                      ZUsed = true;
                      
                  }
  
                  break;
  
              case 7:
                  if (OUsed == false) {
                      randomTetrominoName = "Prefabs/O";
                      OUsed = true;
                      
                  }
  
                  break;
              
  
          }
  
          // Return the location of the next Tetromino specified by the switch.
          return randomTetrominoName;
  
      }
      public void spawnNext() {
     // Random Index
 string i = (GameObject)Instantiate(Resources.Load(GetRandomTetromino(), typeof(GameObject)), new Vector2(5.0f, 20.0f), Quaternion.identity);
 
     // Spawn Group at current Position
     
 }
 void Start() {
     // Spawn initial Group
     spawnNext();
 }

i copied from another what is wrong?

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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

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

Related Questions

unexpected symbol 1 Answer

Looking through all the children doesn't work 1 Answer

Unexplainable NullReferenceException? 0 Answers

3D grid tetris game problem! 0 Answers

Unexplainable NullReferenceException? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges