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 Carbongrip · Feb 20, 2014 at 10:40 PM · c#transformfpshideshow

Creating Objects and Hiding when out of Range

Ok so I want to work on a basic game and make the world out of cubes which I manually create the maps with for loops. Problem is that after 40x40x40 fps gets unstable going from 30-50fps. I asked around and everyone suggested using triangles and blah blah blah. It's way more complex than I want and can understand. So I decided to only create levels when my player.transform.position.y is less than a point. It works great! But how can I make certain areas non visible when my position is a certain point? Can anyone provide some visual code examples? Feel free to add to my code seen bellow.

     bool addlevel3 = true;
     public GameObject player;
     public Transform packIce;
     public Transform Ice;
 
     void Awake()
     {
         for (int x = 0; x < 40; x++)
         {
             for (int y = 0; y > -2; y--)
             {
                 for(int z = 0; z < 40; z++)
                 {
                     Instantiate (packIce, new Vector3(x, y, z), Quaternion.identity);
                 }
             }
         }
 
         iceSpike();
     }
     
     void Update()
     {
         if(player.transform.position.y < 1 && addlevel3 == true)
         {
             addlevel3 = false ;
             for (int x = 0; x < 40; x++)
             {
                 for (int y = -2; y > -3; y--)
                 {
                     for(int z = 0; z < 40; z++)
                     {
                         Instantiate (Ice, new Vector3(x, y, z), Quaternion.identity);
                     }
                 }
             }
         }
     }
Comment
Add comment · Show 13
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 mattyman174 · Feb 20, 2014 at 10:53 PM 0
Share

Dude why do you need Instantiate 3200 Objects??

And then again, another 4800?

avatar image Carbongrip · Feb 20, 2014 at 11:03 PM 0
Share

It's for a $$anonymous$$e craft style game for a little fun and I want a basic way of increasing fps hints the above. I don't know just a little project I suppose.

avatar image mattyman174 · Feb 20, 2014 at 11:03 PM 0
Share

What exactly are you trying to achieve. If you want help in achieving a solid goal, a little more background information might be useful. The way your going about it right now seems to me to be all wrong, your FPS problem is very apparent in its cause.

avatar image mattyman174 · Feb 20, 2014 at 11:06 PM 0
Share

You cant just Instantiate the entire world all at once. If you look at $$anonymous$$inecraft when it loads a new world, it generates large chunks of the world 1 at a time, not all at once, if it did it all at once it would run into the same problem your having. You need to break up the Generation of your world into manageable chunks and then load them at appropriate times. This will reduce the impact on your system resources and smooth out overall frame rate.

avatar image unimechanic ♦♦ · Feb 21, 2014 at 06:28 PM 1
Share

Voted this question up, but bear in $$anonymous$$d this question could have different correct answers, and is mostly intended for discussion of best practices, you could post it in the forums ins$$anonymous$$d in order to receive more ideas. If you have received an answer to your original question please mark this as [SOLVED] or answer it below, so we can move it out of the Unanswered view and give more relevance to other questions requiring attention. Thanks for your comprehension, Unity Support.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by unimechanic · Feb 24, 2014 at 11:38 PM

It's for a mine craft style game for a little fun and I want a basic way of increasing fps hints the above. I don't know just a little project I suppose.

You can read the basics of building a Minecraft style world here:

http://forum.unity3d.com/threads/192954-CoreDev-Creating-Voxelised-Worlds-(Like-Minecraft!)

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

20 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

Related Questions

Custom Inspector, duplicates variables ? 1 Answer

hide button 1 Answer

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

How to instanciate transform to element of a list?,How Get Transform of a instanciated Prefap 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