private void DoImportIcons() { m_SuperIcons = ScriptableObject.CreateInstance <SuperIcons>(); m_SuperIcons.name = "Icons"; m_SuperIcons.AssignIcons(); AssetImportContext.AddObjectToAsset("_icons", m_SuperIcons); }
// The map object is our Main Asset - the prefab that is created in our scene when dragged into the hierarchy private bool PrepareMainObject() { var icon = SuperIcons.GetTmxIcon(); var goGrid = new GameObject("_MapMainObject"); SuperImportContext.AddObjectToAsset("_MapPrfab", goGrid, icon); SuperImportContext.SetMainObject(goGrid); m_MapComponent = goGrid.AddComponent <SuperMap>(); return(true); }
private void CreateTileset(XElement xTileset) { Assert.IsNull(this.Tileset); var icon = SuperIcons.GetTsxIcon(); Tileset = ScriptableObject.CreateInstance <SuperTileset>(); Tileset.m_IsInternal = false; SuperImportContext.AddObjectToAsset("_TilesetScriptObject", Tileset, icon); SuperImportContext.SetMainObject(this.Tileset); var loader = new TilesetLoader(this.Tileset, this, m_UseSpriteAtlas, (int)m_AtlasWidth, (int)m_AtlasHeight); loader.LoadFromXml(xTileset); }
private void PushAtlasTexture() { string textureName = string.Format("Atlas_{0}_{1}", m_TilesetScript.name, m_AtlasTextures.Count + 1); // Create the texture with a starter color that stands out m_CurrentAtlas = new Texture2D(m_AtlasWidth, m_AtlasHeight, TextureFormat.ARGB32, false); m_CurrentAtlas.wrapMode = TextureWrapMode.Clamp; m_CurrentAtlas.filterMode = FilterMode.Point; m_CurrentAtlas.name = textureName; m_CurrentAtlas.SetPixels(Enumerable.Repeat(NamedColors.DeepPink, m_AtlasWidth * m_AtlasHeight).ToArray()); // Add the texture to our import context and our list of textures var icon = SuperIcons.GetTsxIcon(); m_TiledAssetImporter.SuperImportContext.AddObjectToAsset(textureName, m_CurrentAtlas, icon); m_AtlasTextures.Add(m_CurrentAtlas); // Start a new packer to go along with our atlas m_CurrentPacker = new Packer(m_AtlasWidth, m_AtlasHeight, false); }
protected override void InternalOnImportAsset() { base.InternalOnImportAsset(); ImporterVersion = ImporterConstants.WorldVersion; AddSuperAsset <SuperAssetWorld>(); var goWorld = new GameObject("world"); var icon = SuperIcons.GetWorldIcon(); SuperImportContext.AddObjectToAsset("_world", goWorld, icon); SuperImportContext.SetMainObject(goWorld); goWorld.AddComponent <SuperWorld>(); try { ParseJsonAsset(goWorld); } catch (Exception ex) { ReportError("Unknown error importing World file: {0}\n{1}\n{2}", assetPath, ex.Message, ex.StackTrace); } }
public SuperImportContext(UnityEditor.AssetImporters.AssetImportContext context, ST2USettings settings, SuperIcons icons) { m_Context = context; Settings = settings; Icons = icons; }
public SuperImportContext(AssetImportContext context, ST2USettings settings, SuperIcons icons) { m_Context = context; Settings = settings; Icons = icons; }