Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 davebuchhofer · Dec 11, 2009 at 04:39 PM · editoreditor-scripting

How can i use the Instancing in max to Place/Replace/Instantiate in Unity

I have an array of items in a 3dsmax FBX file, i name the objects as 'instance_objName##' and would like to use an AssetPostProcessor to utilize instancing in Unity

My initial attempts to even get the AssetPostProcessor to do anything are failing so far, this seems a good of a spot as any to record the progress :)

using UnityEngine; using UnityEditor; using System.Collections;

public class AssetPost_InstancesByPrefix : AssetPostprocessor { void OnPostProcessModel(GameObject g) { Debug.Log("Never gets called? " + g.name); ProcessInstances(g.transform); }

 void ProcessInstances(Transform obj)
 {
     Debug.Log("WTF doesn't this work " + obj.name);

     foreach (Transform child in obj)
         ProcessInstances(child);
 }

}

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

3 Replies

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

Answer by BogdanDude · Jan 09, 2010 at 10:47 AM

Check out this editor script I wrote: http://forum.unity3d.com/viewtopic.php?p=237536#237536

It will make your instancing automatically, going from your 3D app to Unity (automatically places the prefabs).

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 davebuchhofer · Jan 11, 2010 at 07:50 PM 0
Share

Thank you, I was actually just adding a generic-Instance-Replace type script to my list of things to build~

avatar image
0

Answer by Lucas Meijer 1 · Dec 11, 2009 at 07:32 PM

It's not getting called because you forgot to make it static. I should really just add some sort of check for a nonstatic version and throw a warning, as this seems to trip up many people. hmm, I think I even added a "If it doesn't work you forgot to make it static" note to the help page :). On a different node, why do you think you need to do this in the first place?

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 davebuchhofer · Dec 11, 2009 at 07:47 PM 0
Share

Honestly i'm not sure, I'm experimenting and looking for ways to streamline the general process for Architectual work, and was thinking that maybe if my 30some fairly high poly objects that are identical were all using the same meshfilter there would be some sort of performance benefit over have individual unique copies of the same mesh

avatar image Jessy · Dec 12, 2009 at 02:14 PM 0
Share

I think this is absolutely essential. Unity does not have appropriate tools for content creation. Therefore, the only realistic solution is to do all non-terrain level editing externally. The mesh situation does save on memory, but more importantly, it's a lot more than meshes that can get stored in prefabs. I don't use the AssetPostprocessor, though. I tried it, ran into several bugs, and later realized that I didn't want the process to be so automatic anyway. Now I just run a script that instantiates prefabs if anything in the fbx contains a certain name.

avatar image
0

Answer by davebuchhofer · Dec 12, 2009 at 07:18 AM

The trick i was looking for was actually the Combine Children script! that drastically improved the problem of tons of 3dsmax instances.

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

No one has followed this question yet.

Related Questions

Execute Code When Component Added 6 Answers

How to record hideFlags for Undo/Redo 0 Answers

How do you hide a GameObject's handles? 1 Answer

Changes to Object made in custom Editor Window don't persist 0 Answers

How do you save changes made with custom editor? 3 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