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 Bovine · Aug 26, 2012 at 09:14 AM · meshscenestaticrootcombined mesh

Combined Mesh (root: scene) - How can I detect if a Mesh is a static combination?

This isn't as simple as it might sound - at least not to me!

If you make a call Resources.FindObjectsOfTypeAll(typeof(Mesh)) and you have any static batching going on, you will get back one or more meshes with the name Combined Mesh (root: scene). My understanding is that these meshes are the result of applying static batching to a scene (please shout loudly if you know differently!).

I'd like to identify this mesh as being the static combination of some other meshes, as I need to be able to treat it differently. I could consider all meshes with a name beginning Combined Mesh as static, but it does feel a bit hacky. The only thing I can see that might be useful, is that the underlying instance ID

 some_mesh.m_UnityRuntimeReferenceData.instanceID

Is negative, but firstly, I don't know if that's going to persist either, or just a fluke of my setup and secondly I think I'd have to use reflection to get at this ID, although that's probably not too much of a problem.

Has anyone done this? Does anyone else have any suggestions?

Please read the question thoroughly - I am not after determining whether a gameObject is marked static.

Thanks Bovine

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 Bovine · Aug 26, 2012 at 10:08 AM 0
Share

Ahh, if negative are Unity Engine runtime created items, then Object.GetInstanceID() makes it easy to see the instanceID I'm seeing here...

I see editor items such as cube, sphere, capsule etc... so these are Unity items, but presumably exist for rapidly drawing the built-in primitives?

1 Reply

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

Answer by whydoidoit · Aug 26, 2012 at 11:11 AM

Yes a negative GetInstanceID() does indicate that the object was created at run time. Positive IDs will be either scene or project objects (it's a bit of a shame that it is hard to distinguish between those two categories at runtime - though it can be done in the Editor).

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 Bovine · Dec 30, 2012 at 05:48 PM 0
Share

And as we discovered, much to our irritation, this did not persist on iOS where many of my runtime objects had positive IDs that in the editor had been negative :-/

avatar image whydoidoit · Dec 30, 2012 at 06:27 PM 0
Share

Oh hell. Really?

avatar image Bovine · Dec 31, 2012 at 01:05 PM 0
Share

Aye, you may recall I had to resort to inspecting the name of the mesh, which is fragile to say the least! :o/

avatar image whydoidoit · Dec 31, 2012 at 01:09 PM 0
Share

Oh yeah - I recall now...

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

8 People are following this question.

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

Related Questions

custom staticBatchRoot for build time static meshes? 1 Answer

Missing shaded wireframe option in unity 2019.1.3f,shaded wireframe not showing(LWRP) unity 2019.1.3f 1 Answer

How to use same code at multiple scenes ? 1 Answer

Materials disappear on Mobile when more then one is set to static batching. 0 Answers

How to access a texture2d from another scene 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