Unity實現精靈資源動態加載


    private Sprite LoadSourceSprite(string relativePath)
    {
        //把資源加載到內存中
        UnityEngine.Object Preb = Resources.Load(relativePath, typeof(Sprite));
        Sprite sprite = null;

        ExceptionHandler.Assert(() => { sprite = Instantiate(Preb) as Sprite; });

        //用加載得到的資源對象,實例化游戲對象,實現游戲物體的動態加載
        return sprite;
    }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM