Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by markblank05 · Dec 27, 2015 at 01:53 PM · scripting problemgameobjectsfog of war

Having 5k+ gameobject

I'm making a basic tile fog but I'm having a huge problem, i need about 5k of those plane (scale to .5) to cover my entire level. it doesn't lag on my pc but it do lag on android, the tiling and revealing are all done, i make a mistake in not thinking ahead, what is the best way to make fog that I can save and load? and does unity renderer object that are not seen in the main camera?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by tanoshimi · Dec 27, 2015 at 03:15 PM

A gameobject is an entity in your game - it has its own name, location, position, rotation. It can have relationships to other game objects. It can be cloned and destroyed. The very fact that a gameobject exists in your scene means that memory and CPU resources are required by that object - whether it is being rendered or not. It is very unlikely that you ever want to have 5,000 gameobjects. But it is unclear exactly what the solution is without understanding more about your game: why do you need to "save and load" fog? Does fog have a material effect on the mechanics of the game rather than just aesthetic?

  • A fog effect is fairly trivial to create using shaders or image effects. In fact, Unity comes supplied with several models of in-built fog. Particles are another alternative. However, it's tricky to change or "save" the state of fog created like this - it's just a visual effect.

  • If you want a custom fog plane, you can define a dynamic mesh to which you alter vertices and triangles in runtime. It'll be much faster than having several gameobjects. You could serialise the state of the mesh at any time to save and restore it, but it would probably take more work up front to get working.

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
0

Answer by IgorAherne · Dec 27, 2015 at 01:57 PM

This is an issue to be addressed by shaders, to have few, "fog" objects.

However, I think it's possible to be solved in a dirty way with particle systems. You could simulate what you currently have with fairly large-sized particles, and correct fog textures. Just make sure their movement is zero and that they always face camera. Particle systems are much cheaper than having such a huge number of items. Each one can be passed to GPU in 1 draw call, + you will have a significantly smaller number of such items.

Each object has an axis-aligned bounding box, which envelops the entire object. As soon as all of the box goes off screen, the object is not drawn by the GPU.

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 markblank05 · Dec 27, 2015 at 02:19 PM 0
Share

but can you save and load which are reveal or not using particle? and how to m ake it? and about the draw, my fog is never seen on the main camera, why is it lagging? and only like 50 are shown in my $$anonymous$$i map camera

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

32 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple instances of an object referencing a variable in a script but having different values? 1 Answer

Get player and enemy hit bars to respond to each others attack not their own 1 Answer

Trying to build Carshop, i need help with making list/array of the activating and deactivating car gameobjects. 0 Answers

Child-saving script 1 Answer

How do I make my player object shoot shots on mobile? 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