Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
1
Question by DasHouse · Oct 15, 2015 at 01:30 PM · inspectorvariablesanimations

Inspector won't let me assign a (public) variable

Hello,

I've written the following script:

using UnityEngine; using System.Collections;

public class revolverMoveAnimScript : MonoBehaviour {

 public Animation anim;

 void Update () {
     if (Input.GetKeyDown(KeyCode.W) && anim.isPlaying == false)
     {
         anim.Play();
     }
 }

 void Start()
 {
     gameObject.GetComponent<Animator>().Stop();
 }
 }

Now if I want to assign my animation to the variable in the inspector, i click that little circle-like button-thingy in the inspector right next to the TextBar saying "None (Animation)", goto "assets", doubleclick my animation and - nothing happens. My variable is still unassigned.

Why does the inspector troll me?

Comment
Add comment · Show 5
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 Dave-Carlile · Oct 15, 2015 at 02:02 PM 0
Share

What happens if you drag & drop the animation ins$$anonymous$$d?

avatar image DasHouse Dave-Carlile · Oct 15, 2015 at 03:46 PM 0
Share

The same, actually..

avatar image Dave-Carlile DasHouse · Oct 15, 2015 at 04:19 PM 0
Share

Does it actually let you drop it on there? And it shows that it's not set? Or does it not give you the drop icon at all and won't let you set it?

Show more comments
avatar image Dave-Carlile · Oct 16, 2015 at 02:50 PM 0
Share

I've not done anything with the animation system, but it sounds like the asset you're trying to use isn't the right kind of asset, or the Animation class (the data type for your anim field) isn't the correct class.

Some things to look at in this question: http://answers.unity3d.com/questions/560499/animations-not-accepted-in-animator.html

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by meat5000 · Oct 16, 2015 at 03:50 PM

Are you trying to add an Animation Clip?

'Animation' is a component is it not?

That box wants you to drag in the gameObject with the Animation Component you wish to interact with. It does not accept Clips, which go in to the Animator component itself I do believe.

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 DasHouse · Oct 17, 2015 at 03:13 PM 0
Share

As far as I can see, I'm trying to add an animation. Not an animation clip..

avatar image
0

Answer by sh_code · Oct 24, 2016 at 08:51 AM

I have the same problem, except I'm trying to assign prefab by drag'n'dropping it into

public GameObject whatever;

neither drag'n'drop nor assignment from the list under the circle button doesn't work. only on that one specific script, everywhere else it works normally.

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 Mazer83 · Mar 03, 2017 at 06:21 PM

@DasHouse

Create a class that has a public Animation member.

Create an object in the hierarchy view. Press: Add Component. Choose Scripts-> the script for your new class

Drag the object into your assets folder so that you have a prefab of it. Delete it from your scene.

Drag the prefab onto the "anim" member in the inspector.

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

35 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

Related Questions

Pickup Animation for Closest Object 1 Answer

Can't drag objects into the script's Object Inspector public variables 1 Answer

I removed a variable from my script but it still shows up in the inspector,I removed a public int from my script yet it stills shows up in the inspector when looking at the script component 2 Answers

Can I have a variable accessed through the inspector and be accessed by a child script without making it public? 1 Answer

How do I make the variables in the inspector to appear? 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