• 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 thiago.valle · Mar 22, 2014 at 04:12 PM · animationcurveproperty fields

How to animate properties stored in arrays?

I created a script that has an array of Rects and i want to animate them in the Animation window.

Something like

 public class Hitbox : MonoBehaviour
 {
     public Rect[] rect;
 }

I have another script that draws the Hitbox on the SceneView, the thing is that Unity doesn't seem to support arrays in the Animation window when i try to add a new curve, the only property that is shown to me is the Enabled property, is there any way to solve this?

Comment
Add comment · Show 1
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 Simon-Larsen · Mar 24, 2014 at 02:28 AM 0
Share

I'd recommend adding all your Rects as a single Rect and not as an array. rect1, rect2, etc.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by paulordbm · Mar 24, 2014 at 08:20 PM

You could make a Rect-like class extend Monobehaviour and add multiple copies of it to your GameObject as needed. Each copy will show up at the Animation window. In the script you had the array of Rects, populate it with GetComponents() and now you should be cool =)

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.

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

22 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

Related Questions

How can I set the tangents of Keyframes in an AnimationCurve through scripting? 1 Answer

Why is Unity Adding Extra Frames to Animation? 4 Answers

Parameterising one axis of collider - projecting extents not quite working. 1 Answer

Adding different animations to the Unity Locomotion System 0 Answers

Animation Curves and Mecanim 0 Answers

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