Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 Tanoshimi2000 · Mar 31, 2014 at 01:39 AM · materialsfbxruntimeloading filecar-tutorial

What is the best way to modify the Car Tutorial for more cars?

I've done some extensive work on the Car Tutorial, making my own levels, checking for whether on the road, adding a speedometer and tachometer. Now I want to change the car.

I was thinking I could just load a different .fbx at runtime and change the stats on the car for suspension and acceleration, etc. To that end, I was thinking of storing all the information for all of the cars in an XML file, and basically selecting a car from the list of cars in the xml file.

Three questions:

  1. Is that the best way to handle this?

  2. I've noticed that the car is not just a single fbx, and that I'd need to load my fbx, and set a texture/material. Is there any direction/tutorials on loading and skinning a car (that can be used with the tutorial) at runtime?

  3. Does Unity offer native support for reading/writing XML files or will I need to write my own class?

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 getyour411 · Mar 31, 2014 at 01:40 AM 0
Share
  1. Sounds fine

  2. Sorry, no clue

  3. Yes if you consider System.IO and similar stuff "native"; there's plenty of doc/examples on X$$anonymous$$L to get you started (but you'll need to write your own basic class)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Jiro-Ng · Mar 31, 2014 at 04:18 AM

1. I'm not sure about it but i don't think this will work.

2. Create a prefab for each car model. You can set all those material, acceleration, etc to prefab. During runtime, you just need to instantiate the selected car prefab.

3. http://unitynoobs.blogspot.com/2011/02/xml-loading-data-from-xml-file.html (c#) http://answers.unity3d.com/questions/155868/how-load-xml-file-in-java.html (java)

Comment
Add comment · Show 4 · 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 Tanoshimi2000 · Mar 31, 2014 at 11:19 AM 0
Share

Seems like this makes sense. Are all the prefabs in the hierarchy, or just in the Assets folder?

avatar image Jiro-Ng · Apr 08, 2014 at 08:02 AM 0
Share

In the assets folder, you doesn't need to drag them to the hierarchy, but need to pass to the script that instantiate the prefab

avatar image Tanoshimi2000 · Apr 23, 2014 at 12:15 AM 0
Share

@Jiro: I've been trying to figure out how to do this. I've made a copy of the car prefab. I can't modify the variables (acceleration, etc) because both prefabs use the same script, and changing it for one changes it for all. $$anonymous$$aybe I'd be better off making a single prefab for a car, and loading/setting it's variables (mesh, skin, acceleration) from datafiles?

avatar image Jiro-Ng · Apr 23, 2014 at 08:48 AM 0
Share

Yes you can. You can use the same script in different cars. Are you changing the variable in the inspector?

avatar image
0

Answer by Tanoshimi2000 · Apr 23, 2014 at 12:21 PM

I figured you could change the inspector variables and that would not affect the script directly. It was just those variables that were not public (in the inspector), and also the way the code handled certain things that I would need to change. Last night I bought a package of cars, and started modifying the scripts to work with them instead. Since they're all built identically, once I modify the script, I can use it with any of them.

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

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 to load a large number of fbx files in runtime(files from Navisworks) 0 Answers

Export objects to a .3DS file at runtime 1 Answer

Set up Maya/FBX file so that it is automatically assigned an existing material on import? 2 Answers

Textures not in-tact in FBX import 3 Answers

Setting Avatar to Humanoid at runtime 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