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 /
This question was closed Jul 20, 2017 at 11:32 AM by agarcialeon for the following reason:

La pregunta fué respondida y una respuesta ha sido aceptada

avatar image
0
Question by agarcialeon · Jul 18, 2017 at 08:32 AM · transformserializationxmlmapping

Mapping between classes for serialization

Well, I'm working on a WebGL app that allows the user to add contents like images, sounds, 3D objects, etc... over augmented reality targets.

This app is responsible of the creation of any of the contents and later it should serialize all the contents added by the user and save them in a server to be able to reproduce them in a mobile app.

My problem is: I want to save the position data of the contents that the user adds but since I'm trying to serialize the data from the scripts attached to each content (i.e. image gameobject has a image script) and those scripts inherit from Monobehavior I can't serialize the transform data for that content.

So now I'm trying to find a solution for that issue creating separate scripts that contain only the data that will be saved (without being attached to a gameobject) and I was thinking, is there a library or something similar to Automapper in C# to map the values between the scripts when the app saves the data?

Note: I've also tried downloading Automapper dll and use it as a plugin but I can't find a proper version that works with .Net Unity Subset 3.5.

Thanks in advance.

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

2 Replies

  • Sort: 
avatar image
0
Best Answer

Answer by agarcialeon · Jul 20, 2017 at 11:32 AM

Here is my answer:

I haven't found a a solution trying to use Automapper so here is what I have done to fix my problem.

I have created a class (not derived from Monobehavior) for each of the contents types. These contain the serialization attributes and the properties that I need to save (not all the properties saved in the monobehavior classes attached to the gameobjects).

So with this setup, when I need to call the serialization method, I call another method that manages to create any of these "serializable" classes with the data that they need.

Thanks to @RF008 for the original idea.

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
1

Answer by RF008 · Jul 18, 2017 at 02:38 PM

You can store the transform position rotation using json string and you can get the json for that object and you can set the position and rotation from the json.

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

Follow this Question

Answers Answers and Comments

73 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

Related Questions

How do I keep references to unique NPCs between scenes? 1 Answer

Serializing an Action as XML? 0 Answers

Questions about XML serialization of Class Properties 1 Answer

Saving serializable class list at runtime. 1 Answer

How to save my serialized levels ? 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