0

uncheck animator:

enter image description here

after check animator:

enter image description here

the Animator: enter image description here

the Block Prefab with Animator: enter image description here when i drag one block to other same number block,then trigger the merge animation, which scale up block and then scale to normal, but before apply merge animation, the block displayed larger than default when idle animation.

At first I doubt that the merge animation could result in the block bigger so i change the merge animation from scale up to down, but same result, the problem is that I have not triggered merge action!!!

the wierd is that the prefab will display normal size if it was located in hierarchy. if the prefab was created by C# code , it will displayed larger than normal size!!!

the scale of prefab created by c# code was equals to prefab that was located in hierarchy!!! Their values are equal to 1,but display size are different

enter image description here enter image description here

I want to keep the same size of my prefab before apply merger animation when animator is in Idle state!!! appriciate any advise, please tell me how to keep the original size when gameobject in idle aniamtion

gameObject = GameObject.Instantiate(prefab, pos, rotate);
6
  • What is your animation doing? What does your hierarchy look like? Do you have any other scripts running?
    – NSJacob1
    Jun 6, 2020 at 16:09
  • @NSJacob1 Thanks for your reminder, I add some information
    – banks
    Jun 7, 2020 at 1:29
  • "the wierd is that the prefab will display normal size if it was located in hierarchy. if the prefab was created by C# code , it will displayed larger than normal size!!!"
    – NSJacob1
    Jun 7, 2020 at 17:33
  • Can't edit comment on mobile it seems...
    – NSJacob1
    Jun 7, 2020 at 17:34
  • When you instantiate through C#, do you see different scale or position values on that object in the inspector, compared to one you placed in the scene from the project window?
    – NSJacob1
    Jun 7, 2020 at 17:35

1 Answer 1

1

Try with adding them directly to game. Not in Window in game, GamePanel as child.

7
  • the display is larger than normal size if add them directly to game, which is not i want, i want the display size is same as normal that the special one in window game
    – banks
    Jun 8, 2020 at 12:28
  • When I uncheck animator, the size is correctly, but when check animator, the size of display is larger than uncheck animator. The blocks in the window are just for reference,that is what i want, Block_x_x_(num) is created by C# code,but display error, the block in window game, display right, why?
    – banks
    Jun 8, 2020 at 12:34
  • I said it because I wondered if it going to work when you add the objects direcly game with c#. If it spawned with regular size it could help to solution.
    – Ege
    Jun 8, 2020 at 13:28
  • All blocks are created by C# :Block block = PrefabFactory.Spawn<Block>(prefabs.block, pos, Quaternion.identity); block.transform.SetParent(gamePanel.transform);
    – banks
    Jun 8, 2020 at 14:23
  • 1
    I think when you normally animating child unity adds the animator component to parent. But when you add it with c# as a child animator is still being in added object. And parent's size effects the child's size. I am not sure but I think it is kind a bug.
    – Ege
    Jun 10, 2020 at 9:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.