• 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
-1
Question by Facepalm · Mar 09, 2012 at 07:29 PM · modelruntimeassign

Adding model in runtime

I have some models from warcraft3 converted into 3ds and I need to assing it to mine default object (cube with collider and mesh). How can I do that?

P.S.: C# examples are welcome.

Comment
Add comment · Show 2
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 Meltdown · Mar 09, 2012 at 08:20 PM 0
Share

"and I need to assing it to $$anonymous$$e default object" ?? Sorry I have no idea what that means. Please edit your question and explain better.

avatar image Facepalm · Mar 09, 2012 at 08:34 PM 0
Share

"$$anonymous$$e default object [b](cube with collider and mesh)[/b]" But ok, to clarify I will give example: game started and I'm creating that cube; now I want to add model that is stored in Resources folder to that cube. Thats it, nothing else. $$anonymous$$ore clear now? =)

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Kleptomaniac · Mar 10, 2012 at 05:18 AM

To be honest, I have really no idea what you are trying to do here, but I'll give it a bash. (Also, I'm terrible with C#, so I'll give you an example in JScript and you can convert ... that is if it has anything to with what you want to do):

 function Start () {
 var mesh : Mesh = GetComponent(MeshFilter).mesh;
 mesh = Resources.Load("foo"); //You will need to replace foo with the name of your mesh
 }

I think that should work. Needs to be assigned to your 'default object'. Created on fly so I can't be sure if it will work!

Klep

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 DaveA · Mar 09, 2012 at 08:53 PM

http://unity3d.com/support/documentation/ScriptReference/Resources.Load.html

Comment
Add comment · Show 2 · 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 Facepalm · Mar 10, 2012 at 05:01 AM 0
Share

I know how to load stuff and it's not what I'm asking about =)

avatar image Meltdown · Mar 10, 2012 at 05:54 AM 2
Share

Facepalm the explanation of your question leaves a lot to be desired. If you want a good answer you need to ask a good question.

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to Change Parenting while in game? C# 1 Answer

Mesh change at runtime or in editor 0 Answers

Model building in Unity with primitives and prefabs - opinions desired. 2 Answers

runtime model export 3 Answers

Can I read model-data from assets at runtime via script? 2 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