Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Peakz · Sep 09, 2017 at 01:21 PM · animationuisceneviewgameviewanimating

Animation appearing in scene but not in game

I have this animation I've created for when the player's y position goes below a certain value. It displays the word 'Dead' on the screen which increases in size. When testing this it works perfectly in the scene, but won't appear in the game view? The attached screenshot shows how the animation appears (and works at the correct time) in the scene view, but not in the game view. Could anyone help as to why this would be? alt text

unityerror.png (255.5 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

4 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Cuttlas-U · Sep 09, 2017 at 01:28 PM

hi; i think the reason that u can see it in editor and not in game window is the Z position of the sprite ;

try to change the Z value of transform position ;

Comment
Add comment · Show 1 · 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 rwatts707 · Mar 29 at 07:24 AM 0
Share

You are my hero today!!!! I had a SMH moment...I learned why you should zero X/Y/Z when making a new object. thank you Sir!

avatar image
0

Answer by StevenUnu · Sep 09, 2017 at 01:37 PM

It may be that your "Dead" Sprite is in behind the camera so it won't be rendered. Click that little button in the editor above the scene view which says "2d" and you will see your scene in 3d. This way you could set the Z axis properly.

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 Peakz · Sep 09, 2017 at 03:51 PM

@Cuttlas-U @StevenUnu Thank you both for your replies, I had already tried adjusting the Z position of the sprite so unfortunately that is not the fix. Maybe it's something to do with my code:

 public Transform playerPos;
     SpriteRenderer sr;
     Animator anim;
 
 
     // Use this for initialization
     void Start ()
     {
         anim = GetComponent<Animator>();
         sr = GetComponent<SpriteRenderer>();
     }
     
     // Update is called once per frame
     void Update ()
     {
         if (playerPos.position.y <= -9)
         {
             sr.enabled = true;
             anim.SetBool("isDead", true);            
         }
     }

Comment
Add comment · Show 6 · 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 PersianKiller · Sep 09, 2017 at 04:39 PM 0
Share

change order in layer,it might help :).

avatar image Peakz PersianKiller · Sep 09, 2017 at 04:59 PM 0
Share

I have already tried order in layer but thanks for the suggestion!

avatar image StevenUnu · Sep 09, 2017 at 04:59 PM 0
Share

When you are in scene view, you see the sprite as the image you assigned to the Image component. As well as I understood, your sprite has an animation. Is your default state in the animator state machine a visible image? If not, you should make sure your transition conditions DO really somewhen succeed. If it is a visible image or animation, then you should make sure that no transition to a non-visible image is made. If this doesn't help, try using SetActive(bool active) ins$$anonymous$$d of enabled (I did not test it so I'm not sure it works)

avatar image Peakz StevenUnu · Sep 09, 2017 at 05:42 PM 0
Share

I tried rerecording the Idle animation with the sprite renderer turned on (it is turned off unless player pos.y < -9), which seems to make the animation now appear in game. However I now have a new issue of the animation plays once then disappears. I need this animation to stay in it's final frame ins$$anonymous$$d of disappearing, like a classic 'you are dead' screen. Any idea as to why it's disappearing?

avatar image StevenUnu Peakz · Sep 09, 2017 at 06:40 PM 0
Share

Try setting "Has exit time " and "Fixed duration" off in the transition to the Dead State. I'm not sure if this will have any effect or rather any good effect but it's worth trying.

Show more comments
avatar image
0

Answer by Peakz · Sep 09, 2017 at 06:48 PM

I literally just found the fix, I tried ticking 'Apply Root Motion' on the animation component and that seems to have fixed it. No idea why at all but it seems to work. Thanks for all your suggestions!

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

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

209 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 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

Unity Scene View has other Resolution then Game View. 0 Answers

Animation stops in Game window if animated object is not visible in Scene window 0 Answers

Combat Animating 0 Answers

Help with making an animation play for X amount of seconds? 1 Answer

Unity UI Animation does not set end value 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