示例#1
0
    void Start()
    {
                #if !UNITY_EDITOR && UNITY_WEBGL
        WebGLInput.captureAllKeyboardInput = true;
                #endif

        // Enabling pixelPerfect performs poorly on mobile devices atm
        // We enable when running on desktop

        /*if (!Application.isEditor) {
         *
         *      // We trun off PixelPerfect for mobile devices.  This checks andsets accordingly
         #if UNITY_WEBGL_API
         *      GetComponent<Canvas>().pixelPerfect = (GameControl.IsPhoneDetected() || GameControl.GetBrowserVersion() == "Trident 7") ? false : true;
         #endif
         * }
         * else GetComponent<Canvas>().pixelPerfect = true;*/

        GetComponent <Canvas>().pixelPerfect = false;

        // Load up the LoadingAnimation spinner
        _loadingAnimation = GetComponentInChildren <LoadimationAnimation>();

        // ShowLoader ();
    }
    public void UpdateSpriteArray()
    {
        LoadimationAnimation tar = (target as LoadimationAnimation);
        string spriteSheet       = AssetDatabase.GetAssetPath(tar.multiSpriteTexture);

        Object[] objs = AssetDatabase.LoadAllAssetsAtPath(spriteSheet);

        ArrayList alist = new ArrayList();

        foreach (Object o in objs)
        {
            if (o as Sprite != null)
            {
                alist.Add(o as Sprite);
            }
        }
        tar.sprites = (Sprite[])alist.ToArray(typeof(Sprite));
        //	objs = null;
        tar.GetComponent <SpriteRenderer>().sprite = tar.sprites[0];
        EditorUtility.SetDirty(target);
    }