public static scenecreatescene(string scenename);摘要:在執行時用給定的名稱建立乙個空的新場景。
引數:
scenemanager.createscene("game");
public static boolsetactivescene(scene scene);摘要:設定場景為活動。
引數:
scene scene = scenemanager.createscene("game");
摘要:根據場景的名稱或索引載入場景。
引數:載入前準備:file ---> build settings… ---> 將場景新增/拖拽到列表:
後面數字即為場景索引,可以拖動調整順序。
loadscenemode
載入場景模式(列舉)
single
關閉所有當前載入的場景並載入乙個場景。
additive
將場景新增到當前載入的場景。場景疊加。
public static asyncoperationloadsceneasync(int scenebuildindex);
public static asyncoperationloadsceneasync(string scenename, [defaultvalue("loadscenemode.single")] loadscenemode mode);
public static asyncoperationloadsceneasync(string scenename);
public static asyncoperationloadsceneasync(int scenebuildindex, [defaultvalue("loadscenemode.single")] loadscenemode mode);
摘要:在後台非同步載入場景。
引數:
public static asyncoperationunloadsceneasync(int scenebuildindex);
public static asyncoperationunloadsceneasync(string scenename);
public static asyncoperationunloadsceneasync(scene scene);
摘要:非同步銷毀與給定場景關聯的所有遊戲物件,並將場景從scenemanager中移除。
引數:
public static scenegetscenebyname(string name);
摘要:在載入的場景中搜尋具有給定名稱的場景。
public static scenegetscenebybuildindex(int buildindex);
摘要:通過索引獲取場景。
public static scenegetactivescene();
摘要:獲取當前啟用場景。
場景結構體
public stringpath
摘要:場景的相對路徑。
public stringname
摘要:場景的名字。
public boolisloaded
摘要:場景是否被載入。
public intbuildindex
摘要:場景的序號。
public boolisdirty
摘要:如果場景被修改,返回true。
public introotcount
摘要:場景中根節點的個數。
public gameobjectgetrootgameobjects();
public voidgetrootgameobjects(listrootgameobjects);
摘要:返回場景中的所有根物體。
public boolisvalid();
摘要:這是否是乙個有效的場景。例如,如果試圖開啟乙個不存在的場景,則該場景可能無效。 unity指令碼入門
介面 void awake 指令碼載入時呼叫 void onenable 指令碼啟用時呼叫 void start 只呼叫一次,在呼叫update之前呼叫 void update 每幀呼叫一次,每秒接近60次 void lateupdate update呼叫完之後呼叫 void ondisable 取...
Unity 遊戲指令碼解密
現在用unity的遊戲大多都加密了assembly csharp.dll,這篇文章給出乙個通用的解密方法。原理是通過呼叫遊戲自身的libmono.so的匯出函式mono image open from data with name 對遊戲自身指令碼檔案的解密。include include stru...
unity動態新增指令碼
第一種,被呼叫指令碼函式為static型別,呼叫時直接用 指令碼名.函式名 第二種,gameobject.find 指令碼所在的物體的名字 sendmessage 函式名 能呼叫public和private型別函式 第三種,gameobject.find main camera getcompone...