Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Garrettlynch

Newbie
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Garrettlynch

  • Rank
    Newbie

Profile Information

  • Gender
    Not Telling
  • Location:
    UK
  1. I've built a menuitem script to generate streamed level assetbundles from the currently open scene (script below). It worked once but now I get "Error building Player: Failed to move streamed scene file to '/Assets/New Resource.unity3d'." whenever I try to build a bundle. How do I resolve this? Unity crashed at one stage while I was testing this script - is that related? I'm on unity 4 pro. Garrett using UnityEngine; using UnityEditor; using System.Collections; using System.IO; public class ExportLevelAssetBundles { [MenuItem("Assets/Build Level AssetBundle from Open Level")] static void ExportResource () { //bring up save panel to get path and file name string path = EditorUtility.SaveFilePanel("Save Resource", "", "New Resource", "unity3d"); //if there is a path if (path.Length != 0) { //for testing, show the chosen path //Debug.Log(path); //get the current application pathway and split it into an array by forward slashes string[] s = Application.dataPath.Split('/'); //the project name is two forward slashes back from the end of the array string projectName = s[s.Length - 2]; //Debug.Log("project = " + projectName); //get the position of the project name in the path chosen in savefilepanel int offset = path.IndexOf(projectName); //if offset does not return -1 (i.e. no position) if (offset != -1) { //add the length of the project name to the offset offset = offset + projectName.Length; //slice the path into a shortened relative path with the filename string shortenedpath = path.Substring(offset, path.Length - offset); Debug.Log(shortenedpath); //use an ampty levels array to build the currently open scene string[] levels = new string[] {}; //build a streamed scene at the choosen location BuildPipeline.BuildPlayer (levels, shortenedpath, BuildTarget.WebPlayer, BuildOptions.BuildAdditionalStreamedScenes); } else { //if no offset the user is trying to export outside the current project path Debug.Log("You must export to a location in the current projects path."); } } } }
  2. Ok a few screenshots to show what I'm doing (as I'm convinced I must be doing something very simply/stupid wrong). 1) In 01.jpg attached (below) you can see the prefab I've made called "Map_0-0" (the script that loads expects this naming convention). It has terrain data. So I use the "Build AssetBundle From Selection - Track dependencies" script to build my assetbundle with that prefab selected. 2) In 02.jpg attached (below), I'm now running the unity project and four asset bundles have loaded "Map_0-0", "Map_0-1", "Map_1-0" and "Map_1-1". I've highlighted "Map_0-0" (the one I built) and the terrain data is missing. 3) In 03.jpg attached (below), still running the unity project, I've highlighted "Map_0-1" (a pre-built assetbundle that came with the demo I'm using) and the terrain data is there. thanks in advance Garrett
  3. Apologies, here's the link again: http://docs.unity3d.com/Documentation/Manual/BuildingAssetBundles.html <http://docs.unity3d.com/Documentation/Manual/BuildingAssetBundles.html>
  4. Hi I'm having a lot of problems trying to work with assetbundles. I've followed the manual page on building assetbundles (http://docs.unity3d.com/Documentatio...etBundles.html) using the script and every assetbundle I build seems to be empty (even through they are 2.9mb). I can't understand whether I'm building the assetbundle incorrectly or loading/extracting it incorrectly and since they are compressed files that can't be opened manually I can't separate out these to test. Is there a way to check if an assetbundle has been created correctly (view it's contents, how they are organised)? Some way to view the schema inside the assetbundle so I can step through what might be going wrong. I have an assetbundle created by somebody else (from a demo project) and the script I'm using to load/extract that works fine. regards Garrett
  5. I have been trying to apply a texture to a terrain from C for over a week now. New to Unity3D however applying a texture to a primitive took me 30 seconds to figure out what am I not doing correctly here? using UnityEngine; using System.Collections; using Utility; public class test : MonoBehaviour { //use this for initialization void Start () { //create a new terrain data TerrainData _terrainData = new TerrainData(); //set terrain width, height, length _terrainData.size = new Vector3(20, 1, 20); SplatPrototype[] terrainTexture = new SplatPrototype[1]; terrainTexture[0] = new SplatPrototype(); terrainTexture[0].texture = (Texture2D)Resources.Load("Standard Assets/Terrain Assets/Terrain Textures/Grass (Hill)"); _terrainData.splatPrototypes = terrainTexture; //how do I now apply the loaded texture to my terrain? //how do I test if my texture has loaded correctly? //Create a terrain with the set terrain data GameObject _terrain = Terrain.CreateTerrainGameObject(_terrainData); } // Update is called once per frame void Update () { } }
×
×
  • Create New...