Unity3d Optimizing iOS

Source: Internet
Author: User

1.

Using Unityengine;

Class Garbagecollectmanager:monobehaviour {
public int framefreq = 30;
void Update () {
if (time.framecount% Framefreq = = 0)
System.GC.Collect ();

}

2.

using Strict
using #pragma at the top of all your scripts, the script will be strongly typed, avoiding the wrong type assignment when writing code.

avoid object.instantiate () and Object.destroy ()

instantiating and destroying are not good, because they need to dynamically allocate memory when creating and destroying objects, which can temporarily affect performance.
the alternative to consider is to use the Spawnmanager class he wrote. It initializes all of the objects at the beginning of the game, so that you can load objects together when the game is loaded, so that people don't feel the impact.
When you disable objects, they remain in memory and only need to be enabled when they are needed.

There are a few other points that each
Cache Component Lookups

use iTween sparingly less

Avoid setactiverecursively ()

Use Builtin Arrays

Avoid String Comparison strings comparison

Avoid Vector3.magnitude & Vector3.distance ()

ability to see specific instructions at the source of the reference

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.