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
0
Question by emthele · Nov 23, 2016 at 02:44 PM · animationassetfbxsavestandalone

Save animation at runtime (Standalone)

Hello everyone,

I have searched for hours and coulnd't find a solution, so I'm posing my question here.

I have a 3D model whose arms and legs are moved/rotated via sensors. I can "record" the sensor data and the movements in a proprietary quaternion-data-based format I've developed myself. Replay, pause, etc. works fine.

However, I do want to have an .FBX or at least .anim export at the very end, to use the animation in other programs like 3DSMax or Maya. Therefore, I create an AnimationClip from the movements (actually only rotations), which is not the hard part.

The problem is to export the data to the disk. It has to work in the standalone version (later in mobile version, too), so I can't use AssetDatabase or something similar (SerializableObject) to save the animation clip, as I don't have an Editor.

Can anyone tell me what's the way to go? Any kind of hack or trick is also appreciated, it doesn't have to be nice, it just has to work.

Thanks in advance!

edit 24.11:

  • So I've done even more research and got deeper into serialization. Unfortunately, it looks if Unity simply isn't made to save stuff in standalone runtime, without using Editor at all. However, my animation IS created during runtime only (due to sensor input) and I need to have it exported SOMEHOW into .FBX.

  • It doesn't matter if I have to use an external converter to convert from .OBJ (e.g.) to .FBX, but the animation has to be saved as .OBJ first. How could I do that?

  • All I have discovered so far for animations are serializers writing it down to JSON or other binary format. How could I convert that to .FBX or .anim?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Magius96 · Nov 23, 2016 at 09:44 PM

I'm not sure that I fully understand what you are going for, so my answer may be totally off, but here it is.

You can save any type of data you want, but you have to determine where to save. In all of my apps I use Application.PersistantDataPath

So let's say you want to store your animations in a folder called "anims" then you might build your path like this:

 var path = string.Format("{0}/anims/", Application.PersistentDataPath);

Once you have your path, you can use the standard C# stream classes like BinaryReader, BinaryWriter, TextReader, TextWriter, etc.

Now, if you want to write it as a specific file type, you will need to understand the structure of that file type. Thankfully most file types are fully described somewhere on the internet. If you aren't concerned about your file being opened by other software other than what you are producing, then you can simply make it a binary file and design the structure yourself.

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 emthele · Nov 24, 2016 at 08:24 AM 0
Share

Hi,

thanks for answering. I have done that before frequently, when I implemented my own type of saving animations via .txt-files which store the quaternion data. However, I would need to save in ".anim" (or .FBX, I haven't had a detailed look into that yet), which is the animation format in Unity. I don't know if the format is described in detail somewhere, but I'd rather have a one-line "export clip as .anim" ins$$anonymous$$d of writing a file with the whole format myself.

To clarify: I do create the animation I need in runtime. It works fine when using Editor, because I can save and reload the animation afterwards. But now I need to save the animation from the standalone version.

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

150 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

Related Questions

C4D voronoi fracture Export Animation Problem 0 Answers

Character animation issue, head is not having animation effect 0 Answers

Wrong root node from separated anmation fbx model. 0 Answers

Colors change after selecting FBX 0 Answers

Problem while editing animation clips on timeline 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