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 Hello_Lp · May 16, 2013 at 12:03 PM · localscalegeneric list

Object transform.localScale not changing

I am adding some objects in the game but for same reason, the first object I add from a generic list do not change in localScale.

As you can see from the image below, the console displays that localScale is correct, but when you look at the gameview and inspector, the object has a Vector.zero localScale. What's weird is that all the other properties of the object is correct (i.e. object.name is correctly name 3, 7).

The objects after the first are all displayed correctly as well.

Update: If I don't use Queue tile = new Queue(), things work normally..

alt text

Here's the script:

       public void animateGrid(List<int[]> matchTile, List<int[]> moveTile, List<int[]> appendTile){
             animating = true;
             
             Queue<GameObject> tile = new Queue<GameObject>();
             
             Debug.Log ("MatchTile count: " + matchTile.Count);
             Debug.Log ("AddTile count: " + appendTile.Count);
             
             foreach(int[] i in matchTile){
                 tile.Enqueue(getGameObject(i[0], i[1]));
                 match (tile.Peek());
             }
             
             Debug.Log ("tile: " + tile.Count);
             
             foreach(int[] j in appendTile){
                 int x1 = j[0], y1 = j[1], 
                     x2 = j[2], y2 = j[3];
                 
                 GameObject gameObj = tile.Dequeue();
                 
                 Debug.Log ("tileNo");
                 
                 append (    gameObj, 
                             getCoordinateFromGrid(x2, y2), 
                             x2, y2, 
                             grid.filled[x1, y1]
                 );
             }
         ...
     }
 
     private void match(GameObject tile){
         Hashtable optional = new Hashtable();
         optional.Add("ease", LeanTweenType.easeInBounce);
             
         LeanTween.scale(tile, Vector3.zero, 0.05f, optional);    
         tile.SetActive(false);
     }
         
     private void append(GameObject tile, Vector3 position, int x, int y, int type){
         float tileSize = 1f / 9f;
                     
         tile.renderer.material.color     =     getColor(type);
         tile.tag                         =     getType(type);
         tile.name                         =     x + "," + y;
         tile.transform.parent             =     transform.FindChild("Filled").transform;
         tile.transform.position         =     position;
         tile.transform.localScale         =     new Vector3(tileSize, tileSize, 70f);
         tile.SetActive(true);
             
         Debug.Log ("added scale: " + tile.transform.localScale + " x:" + x + " y:" + y);
     }


untitled.png (131.8 kB)
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.

Follow this Question

Answers Answers and Comments

13 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

Related Questions

Issue with changing localScale of gameobject after instantiate 1 Answer

Unity 4.5 LocalScale Changes (2D) 1 Answer

LocalScale doesn't scale sprite to the distance specified 0 Answers

Scaling object by increasing its y position 1 Answer

How to Lerp localScale? 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