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 Twitch · Sep 29, 2012 at 09:11 AM · instantiateobjectsinstancenodes

Using Instance Nodes, worth it?

I am making a 2d game where there are various environments with lots and lots of objects. There is a forest scene with like 1200 objects in total(trees mainly), of which around 100 are visible on the camera at any given time, as you move through the level. These are comprised of around 20 different kind of trees and other props. Each object is usually 2-6 triangles with a transparent texture.

My developer asked me to replace each object in the scene with a node, and keeping only a minimal amount of actual objects which would be 300+ or so(?), since there are a few modified unique meshes. So he can instantiate the actual objects to keep the game light.

Is this actually effective? And if so how much?

I 've read about draw calls and such and I suppose that if I combine each texture (10 kinds of trees) in 1 mesh it will have the same effect?

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 whydoidoit · Sep 29, 2012 at 10:10 AM 0
Share

Good point - missed the 2D bit :) Thought the meshes seem to have more than 2 triangles - which is what got me thinking that this needed to be a pseudo 3d solution.

avatar image Twitch · Sep 29, 2012 at 12:24 PM 0
Share

Node/point is kind of like an empty game object. Which can be created in your 3d app of choice and imported as an fbx to unity. Basically in this case each node would represent a tree and the code would instantiate trees anywhere a node is present.

1 Reply

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

Answer by whydoidoit · Sep 29, 2012 at 09:15 AM

Well you don't really want to be instantiating those objects during game play if you don't have to - that is a pretty expensive operation. What I would do is put all of the objects in the scene and then turn off the renderers for the ones that shouldn't be in view.

I can't think why the size of the game would be improved that way either - the only thing that might improve by all of that instantiating is the load time of the scene. That could be improved by disabling all of the initially hidden game objects too.

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 whydoidoit · Sep 29, 2012 at 09:16 AM 0
Share

I guess another argument might be that you are taking up memory for objects that never come into view. That would make more sense perhaps - again disabling them would remove much of this overhead. I'm presu$$anonymous$$g that trees don;t have many scripts attached to them that are allocating lots of memory in any case.

avatar image Twitch · Sep 29, 2012 at 09:32 AM 0
Share

Thanks for your answer. Sorry if I wasn't clear, there are 100 visible objects on camera, but not the same ones all the time. You can think of it as a filmstrip and each strip has 100 objects in it. So all 1200 gets shown but not at once. Is there a way that you can load progressively as the player walks down the level? The trees as you said don't have any scripts on them.

avatar image whydoidoit · Sep 29, 2012 at 09:39 AM 0
Share

Yeah I got that. I can't see what you are really saving by instantiating them as you go apart from potentially level startup time.

If you want to save draw calls - turn off the renderer (by adding a script) when the object should not be visible.

If you want to improve startup time you could:

a) Split the level into parts and load them additively with LoadLevelAdditiveAsync b) Do what you are doing - but it has an in play cost.

avatar image whydoidoit · Sep 29, 2012 at 09:39 AM 0
Share

If you have Pro you can also use Occlusion Culling

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

12 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

Related Questions

Updating a variable on a script in an instanced object 1 Answer

prefab spawning with variable delay 0 Answers

How to instantiate from prefab, not from instance? 3 Answers

Problem with colliding instances of same object 1 Answer

Instantiating 20K gameobjects performance issue 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