• 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 lozzaaa · Aug 10, 2012 at 08:28 PM · iosmaterialloadinglagdisable

Loading disabled GameObject assets

There are a lot of questions on here about loading but I haven't found one that answers my question.

I have a lot of disabled GameObjects in my scene that are enabled when the player moves towards them. On iOS this causes a lag when the assets from that GameObject are loaded. Is there a way I can load the assets at the start of the scene?

Also the same thing happens when I switch the material of a GameObject at runtime. Is there a way to load an asset that isn't used on anything by default and is only ever applied dynamically?

Comment
Add comment · Show 4
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 OperationDogBird · Aug 11, 2012 at 02:21 AM 0
Share

What do you mean by "when the assets are loaded"? It seems like you should have gameobjects that are already made(containing most of the things they need) and disabled, that way there is no loading during the game since it gets loaded when the scene get loaded. $$anonymous$$aybe you could specify a little more.

As for the last portion about having an asset that isnt on anything, you can have a single script that holds things, for instance your material. Its not used on an object, but when you need it you can just grab it from your variable on that script.

avatar image lozzaaa · Aug 11, 2012 at 09:53 AM 0
Share

That is exactly what I am doing but it doesn't load when the scene is loaded. For instance I have a particle effect that is called when you start the game that makes it lag horribly the first time it is played but from then on it is absolutely fine.

I didn't mean it isn't on anything i meant it is only applied to a mesh during the game so when the game loads it isn't applied to the mesh. This causes the game to lag when i switch the objects material for the first time again but from then on it's fine. It's clearly a loading issue.

avatar image OperationDogBird · Aug 11, 2012 at 07:47 PM 0
Share

"For instance I have a particle effect that is called when you start the game" Does this mean you are manually loading it using Resources.Load() ?

You can have a script on an empty object in the scene that holds things like.. materials, particle effects, etc. That way they load with the scene and no manual loading is required.

 Global.js

 public var material:$$anonymous$$aterial;
 public var particles:ParticleEmitter;

then when you want to change the material, say

 //First set a reference to the Global script

 renderer.material=global.material;
avatar image AnXgotta · Aug 12, 2012 at 04:28 AM 0
Share

With particle effects on mobile this behavior is normal. The lagging on the first activation of the effect. What I did to correct this is play all the effects for that particular level somewhere far away in game space just as the level loads so the lag isn't noticeable to the player. From then on it will be fine.

0 Replies

· Add your reply
  • Sort: 

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

iOS Strange Render Lag 1 Answer

Assigning material color with GetPixelBilinear iOS 0 Answers

loading a scene seems to be slower 0 Answers

disable code when level is rendered 1 Answer

Touch Delay / Lag in Movement only on iOS Device 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