Unity: convert 3d mesh level generator code to 2d sprite level generator











up vote
0
down vote

favorite












Currently have a script that generates a level using 3d mesh to create hills for a side scroller game that follows the camera.



I would like to work on this script and get help on how to convert it to a 2d level generator using sprites and 2d polygon colliders.



If you use a 2DCollider player it will go through the level because its 3D collider.



How time worthy does the conversion look?



Thanks



using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using Endless2DTerrain;

public class TerrainDisplayer : MonoBehaviour {

//Length of preview in design view
public float PreviewLength;

//Our list of terrain generation and prefab generation rules
public List<TerrainRule> Rules;
public List<PrefabRule> PrefabRules;

//The front plane material, tiling, etc.
public Material MainMaterial;
public float MainMaterialXTiling;
public float MainMaterialYTiling;
public float MainMaterialRotation;
public float MainPlaneHeight;
public bool MainPlaneFollowTerrainCurve;

//Top plane settings
public Material TopMaterial;
public float TopMaterialXTiling;
public float TopMaterialYTiling;
public float TopMaterialRotation;
public bool DrawTopMeshCollider;
public bool DrawTopMeshRenderer;
public float TopPlaneHeight;

//Detail plane settings
public Material DetailMaterial;
public float DetailMaterialXTiling;
public float DetailMaterialYTiling;
public float DetailMaterialRotation;
public bool DrawDetailMeshRenderer;
public float DetailPlaneHeight;
public bool DetailPlaneFollowTerrainCurve;
public Vector3 DetailPlaneOffset;

//Width for corner mesh where two planes with different angles meet
public float CornerMeshWidth;

private Vector3 OriginalStartPoint { get; set; }
float currentX { get; set; }

private bool coroutineRunning = false;

//References to the terrain and prefab managers
public TerrainManager TerrainManager { get; set; }
public PrefabManager PrefabManager { get; set; }

void Awake()
{
Setup();
}

public void Setup()
{
if (Rules != null)
{
Settings s = new Settings();
s.Rules = Rules;
s.PrefabRules = PrefabRules;

s.MainMaterial = MainMaterial;
s.MainMaterialXTiling = MainMaterialXTiling;
s.MainMaterialYTiling = MainMaterialYTiling;
s.MainMaterialRotation = MainMaterialRotation;

s.TopMaterial = TopMaterial;
s.TopMaterialXTiling = TopMaterialXTiling;
s.TopMaterialYTiling = TopMaterialYTiling;
s.TopMaterialRotation = TopMaterialRotation;
s.DrawTopMeshCollider = DrawTopMeshCollider;
s.DrawTopMeshRenderer = DrawTopMeshRenderer;

s.DetailMaterial = DetailMaterial;
s.DetailMaterialXTiling = DetailMaterialXTiling;
s.DetailMaterialYTiling = DetailMaterialYTiling;
s.DetailMaterialRotation = DetailMaterialRotation;
s.DrawDetailMeshRenderer = DrawDetailMeshRenderer;

s.MainPlaneHeight = MainPlaneHeight;
s.TopPlaneHeight = TopPlaneHeight;
s.DetailPlaneHeight = DetailPlaneHeight;

s.CornerMeshWidth = CornerMeshWidth;

s.OriginalStartPoint = this.transform.position;
s.DetailPlaneOffset = new Vector3(0,.1f,-.2f);

s.MainPlaneFollowTerrainCurve = MainPlaneFollowTerrainCurve;
s.DetailPlaneFollowTerrainCurve = DetailPlaneFollowTerrainCurve;

s.ParentGameObjectName = this.name;
s.terrainDisplayer = this;

TerrainManager = new TerrainManager(s);
PrefabManager = new PrefabManager(s);

Cleanup();
}
}

//Remove the terrain and prefab managers and reset what we need to for the rules. This is called when we switch between edit and play modes
public void Cleanup()
{
if (TerrainManager != null)
{
TerrainManager.RemoveTerrainObject();
}
if (PrefabManager != null)
{
PrefabManager.RemovePrefabObject();
}

for (int i = 0; i < PrefabRules.Count; i++)
{
PrefabRules[i].CurrentLocation = Vector3.zero;
PrefabRules[i].LastPrefabLocation = Vector3.zero;
}
}

// Use this for initialization
void Start()
{
//Generate the initial terrain to avoid slowdown once we start
Shader.WarmupAllShaders();
}

// Update is called once per frame
void Update()
{
if (!coroutineRunning)
{
StartCoroutine(GenerateTerrainCoroutine(100));
}
}

private IEnumerator GenerateTerrainCoroutine(float leadAmount)
{
coroutineRunning = true;

GenerateTerrain(leadAmount);

//No need to run this every frame...just run it every so often
yield return new WaitForSeconds(.2f);

coroutineRunning = false;
}

public void GenerateTerrain(float leadAmount)
{
//Track the right and left sides of the screen so we know how much terrain to generate
Vector3 rightSide = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, -Camera.main.transform.position.z));
Vector3 leftSide = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, -Camera.main.transform.position.z));
float endX = rightSide.x + leadAmount;

while (TerrainManager.VertexGen.CurrentTerrainRule != null && TerrainManager.GetFarthestX() < endX)
{
TerrainManager.Generate(endX);
//Update our prefabs with the current terrain info
PrefabManager.PlacePrefabs(TerrainManager);

TerrainManager.Cleanup(leftSide.x - leadAmount);
PrefabManager.Cleanup(leftSide.x - leadAmount);
}

//Only need this when we are no longer generating any new terrain but still need to do the final object cleanup
if (TerrainManager.VertexGen.CurrentTerrainRule == null && TerrainManager.Pool != null && TerrainManager.Pool.TerrainPieces.Count > 0)
{
TerrainManager.Cleanup(leftSide.x);
PrefabManager.Cleanup(leftSide.x);
}
}
}









share|improve this question


























    up vote
    0
    down vote

    favorite












    Currently have a script that generates a level using 3d mesh to create hills for a side scroller game that follows the camera.



    I would like to work on this script and get help on how to convert it to a 2d level generator using sprites and 2d polygon colliders.



    If you use a 2DCollider player it will go through the level because its 3D collider.



    How time worthy does the conversion look?



    Thanks



    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using Endless2DTerrain;

    public class TerrainDisplayer : MonoBehaviour {

    //Length of preview in design view
    public float PreviewLength;

    //Our list of terrain generation and prefab generation rules
    public List<TerrainRule> Rules;
    public List<PrefabRule> PrefabRules;

    //The front plane material, tiling, etc.
    public Material MainMaterial;
    public float MainMaterialXTiling;
    public float MainMaterialYTiling;
    public float MainMaterialRotation;
    public float MainPlaneHeight;
    public bool MainPlaneFollowTerrainCurve;

    //Top plane settings
    public Material TopMaterial;
    public float TopMaterialXTiling;
    public float TopMaterialYTiling;
    public float TopMaterialRotation;
    public bool DrawTopMeshCollider;
    public bool DrawTopMeshRenderer;
    public float TopPlaneHeight;

    //Detail plane settings
    public Material DetailMaterial;
    public float DetailMaterialXTiling;
    public float DetailMaterialYTiling;
    public float DetailMaterialRotation;
    public bool DrawDetailMeshRenderer;
    public float DetailPlaneHeight;
    public bool DetailPlaneFollowTerrainCurve;
    public Vector3 DetailPlaneOffset;

    //Width for corner mesh where two planes with different angles meet
    public float CornerMeshWidth;

    private Vector3 OriginalStartPoint { get; set; }
    float currentX { get; set; }

    private bool coroutineRunning = false;

    //References to the terrain and prefab managers
    public TerrainManager TerrainManager { get; set; }
    public PrefabManager PrefabManager { get; set; }

    void Awake()
    {
    Setup();
    }

    public void Setup()
    {
    if (Rules != null)
    {
    Settings s = new Settings();
    s.Rules = Rules;
    s.PrefabRules = PrefabRules;

    s.MainMaterial = MainMaterial;
    s.MainMaterialXTiling = MainMaterialXTiling;
    s.MainMaterialYTiling = MainMaterialYTiling;
    s.MainMaterialRotation = MainMaterialRotation;

    s.TopMaterial = TopMaterial;
    s.TopMaterialXTiling = TopMaterialXTiling;
    s.TopMaterialYTiling = TopMaterialYTiling;
    s.TopMaterialRotation = TopMaterialRotation;
    s.DrawTopMeshCollider = DrawTopMeshCollider;
    s.DrawTopMeshRenderer = DrawTopMeshRenderer;

    s.DetailMaterial = DetailMaterial;
    s.DetailMaterialXTiling = DetailMaterialXTiling;
    s.DetailMaterialYTiling = DetailMaterialYTiling;
    s.DetailMaterialRotation = DetailMaterialRotation;
    s.DrawDetailMeshRenderer = DrawDetailMeshRenderer;

    s.MainPlaneHeight = MainPlaneHeight;
    s.TopPlaneHeight = TopPlaneHeight;
    s.DetailPlaneHeight = DetailPlaneHeight;

    s.CornerMeshWidth = CornerMeshWidth;

    s.OriginalStartPoint = this.transform.position;
    s.DetailPlaneOffset = new Vector3(0,.1f,-.2f);

    s.MainPlaneFollowTerrainCurve = MainPlaneFollowTerrainCurve;
    s.DetailPlaneFollowTerrainCurve = DetailPlaneFollowTerrainCurve;

    s.ParentGameObjectName = this.name;
    s.terrainDisplayer = this;

    TerrainManager = new TerrainManager(s);
    PrefabManager = new PrefabManager(s);

    Cleanup();
    }
    }

    //Remove the terrain and prefab managers and reset what we need to for the rules. This is called when we switch between edit and play modes
    public void Cleanup()
    {
    if (TerrainManager != null)
    {
    TerrainManager.RemoveTerrainObject();
    }
    if (PrefabManager != null)
    {
    PrefabManager.RemovePrefabObject();
    }

    for (int i = 0; i < PrefabRules.Count; i++)
    {
    PrefabRules[i].CurrentLocation = Vector3.zero;
    PrefabRules[i].LastPrefabLocation = Vector3.zero;
    }
    }

    // Use this for initialization
    void Start()
    {
    //Generate the initial terrain to avoid slowdown once we start
    Shader.WarmupAllShaders();
    }

    // Update is called once per frame
    void Update()
    {
    if (!coroutineRunning)
    {
    StartCoroutine(GenerateTerrainCoroutine(100));
    }
    }

    private IEnumerator GenerateTerrainCoroutine(float leadAmount)
    {
    coroutineRunning = true;

    GenerateTerrain(leadAmount);

    //No need to run this every frame...just run it every so often
    yield return new WaitForSeconds(.2f);

    coroutineRunning = false;
    }

    public void GenerateTerrain(float leadAmount)
    {
    //Track the right and left sides of the screen so we know how much terrain to generate
    Vector3 rightSide = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, -Camera.main.transform.position.z));
    Vector3 leftSide = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, -Camera.main.transform.position.z));
    float endX = rightSide.x + leadAmount;

    while (TerrainManager.VertexGen.CurrentTerrainRule != null && TerrainManager.GetFarthestX() < endX)
    {
    TerrainManager.Generate(endX);
    //Update our prefabs with the current terrain info
    PrefabManager.PlacePrefabs(TerrainManager);

    TerrainManager.Cleanup(leftSide.x - leadAmount);
    PrefabManager.Cleanup(leftSide.x - leadAmount);
    }

    //Only need this when we are no longer generating any new terrain but still need to do the final object cleanup
    if (TerrainManager.VertexGen.CurrentTerrainRule == null && TerrainManager.Pool != null && TerrainManager.Pool.TerrainPieces.Count > 0)
    {
    TerrainManager.Cleanup(leftSide.x);
    PrefabManager.Cleanup(leftSide.x);
    }
    }
    }









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Currently have a script that generates a level using 3d mesh to create hills for a side scroller game that follows the camera.



      I would like to work on this script and get help on how to convert it to a 2d level generator using sprites and 2d polygon colliders.



      If you use a 2DCollider player it will go through the level because its 3D collider.



      How time worthy does the conversion look?



      Thanks



      using UnityEngine;
      using System.Collections;
      using System.Collections.Generic;
      using Endless2DTerrain;

      public class TerrainDisplayer : MonoBehaviour {

      //Length of preview in design view
      public float PreviewLength;

      //Our list of terrain generation and prefab generation rules
      public List<TerrainRule> Rules;
      public List<PrefabRule> PrefabRules;

      //The front plane material, tiling, etc.
      public Material MainMaterial;
      public float MainMaterialXTiling;
      public float MainMaterialYTiling;
      public float MainMaterialRotation;
      public float MainPlaneHeight;
      public bool MainPlaneFollowTerrainCurve;

      //Top plane settings
      public Material TopMaterial;
      public float TopMaterialXTiling;
      public float TopMaterialYTiling;
      public float TopMaterialRotation;
      public bool DrawTopMeshCollider;
      public bool DrawTopMeshRenderer;
      public float TopPlaneHeight;

      //Detail plane settings
      public Material DetailMaterial;
      public float DetailMaterialXTiling;
      public float DetailMaterialYTiling;
      public float DetailMaterialRotation;
      public bool DrawDetailMeshRenderer;
      public float DetailPlaneHeight;
      public bool DetailPlaneFollowTerrainCurve;
      public Vector3 DetailPlaneOffset;

      //Width for corner mesh where two planes with different angles meet
      public float CornerMeshWidth;

      private Vector3 OriginalStartPoint { get; set; }
      float currentX { get; set; }

      private bool coroutineRunning = false;

      //References to the terrain and prefab managers
      public TerrainManager TerrainManager { get; set; }
      public PrefabManager PrefabManager { get; set; }

      void Awake()
      {
      Setup();
      }

      public void Setup()
      {
      if (Rules != null)
      {
      Settings s = new Settings();
      s.Rules = Rules;
      s.PrefabRules = PrefabRules;

      s.MainMaterial = MainMaterial;
      s.MainMaterialXTiling = MainMaterialXTiling;
      s.MainMaterialYTiling = MainMaterialYTiling;
      s.MainMaterialRotation = MainMaterialRotation;

      s.TopMaterial = TopMaterial;
      s.TopMaterialXTiling = TopMaterialXTiling;
      s.TopMaterialYTiling = TopMaterialYTiling;
      s.TopMaterialRotation = TopMaterialRotation;
      s.DrawTopMeshCollider = DrawTopMeshCollider;
      s.DrawTopMeshRenderer = DrawTopMeshRenderer;

      s.DetailMaterial = DetailMaterial;
      s.DetailMaterialXTiling = DetailMaterialXTiling;
      s.DetailMaterialYTiling = DetailMaterialYTiling;
      s.DetailMaterialRotation = DetailMaterialRotation;
      s.DrawDetailMeshRenderer = DrawDetailMeshRenderer;

      s.MainPlaneHeight = MainPlaneHeight;
      s.TopPlaneHeight = TopPlaneHeight;
      s.DetailPlaneHeight = DetailPlaneHeight;

      s.CornerMeshWidth = CornerMeshWidth;

      s.OriginalStartPoint = this.transform.position;
      s.DetailPlaneOffset = new Vector3(0,.1f,-.2f);

      s.MainPlaneFollowTerrainCurve = MainPlaneFollowTerrainCurve;
      s.DetailPlaneFollowTerrainCurve = DetailPlaneFollowTerrainCurve;

      s.ParentGameObjectName = this.name;
      s.terrainDisplayer = this;

      TerrainManager = new TerrainManager(s);
      PrefabManager = new PrefabManager(s);

      Cleanup();
      }
      }

      //Remove the terrain and prefab managers and reset what we need to for the rules. This is called when we switch between edit and play modes
      public void Cleanup()
      {
      if (TerrainManager != null)
      {
      TerrainManager.RemoveTerrainObject();
      }
      if (PrefabManager != null)
      {
      PrefabManager.RemovePrefabObject();
      }

      for (int i = 0; i < PrefabRules.Count; i++)
      {
      PrefabRules[i].CurrentLocation = Vector3.zero;
      PrefabRules[i].LastPrefabLocation = Vector3.zero;
      }
      }

      // Use this for initialization
      void Start()
      {
      //Generate the initial terrain to avoid slowdown once we start
      Shader.WarmupAllShaders();
      }

      // Update is called once per frame
      void Update()
      {
      if (!coroutineRunning)
      {
      StartCoroutine(GenerateTerrainCoroutine(100));
      }
      }

      private IEnumerator GenerateTerrainCoroutine(float leadAmount)
      {
      coroutineRunning = true;

      GenerateTerrain(leadAmount);

      //No need to run this every frame...just run it every so often
      yield return new WaitForSeconds(.2f);

      coroutineRunning = false;
      }

      public void GenerateTerrain(float leadAmount)
      {
      //Track the right and left sides of the screen so we know how much terrain to generate
      Vector3 rightSide = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, -Camera.main.transform.position.z));
      Vector3 leftSide = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, -Camera.main.transform.position.z));
      float endX = rightSide.x + leadAmount;

      while (TerrainManager.VertexGen.CurrentTerrainRule != null && TerrainManager.GetFarthestX() < endX)
      {
      TerrainManager.Generate(endX);
      //Update our prefabs with the current terrain info
      PrefabManager.PlacePrefabs(TerrainManager);

      TerrainManager.Cleanup(leftSide.x - leadAmount);
      PrefabManager.Cleanup(leftSide.x - leadAmount);
      }

      //Only need this when we are no longer generating any new terrain but still need to do the final object cleanup
      if (TerrainManager.VertexGen.CurrentTerrainRule == null && TerrainManager.Pool != null && TerrainManager.Pool.TerrainPieces.Count > 0)
      {
      TerrainManager.Cleanup(leftSide.x);
      PrefabManager.Cleanup(leftSide.x);
      }
      }
      }









      share|improve this question













      Currently have a script that generates a level using 3d mesh to create hills for a side scroller game that follows the camera.



      I would like to work on this script and get help on how to convert it to a 2d level generator using sprites and 2d polygon colliders.



      If you use a 2DCollider player it will go through the level because its 3D collider.



      How time worthy does the conversion look?



      Thanks



      using UnityEngine;
      using System.Collections;
      using System.Collections.Generic;
      using Endless2DTerrain;

      public class TerrainDisplayer : MonoBehaviour {

      //Length of preview in design view
      public float PreviewLength;

      //Our list of terrain generation and prefab generation rules
      public List<TerrainRule> Rules;
      public List<PrefabRule> PrefabRules;

      //The front plane material, tiling, etc.
      public Material MainMaterial;
      public float MainMaterialXTiling;
      public float MainMaterialYTiling;
      public float MainMaterialRotation;
      public float MainPlaneHeight;
      public bool MainPlaneFollowTerrainCurve;

      //Top plane settings
      public Material TopMaterial;
      public float TopMaterialXTiling;
      public float TopMaterialYTiling;
      public float TopMaterialRotation;
      public bool DrawTopMeshCollider;
      public bool DrawTopMeshRenderer;
      public float TopPlaneHeight;

      //Detail plane settings
      public Material DetailMaterial;
      public float DetailMaterialXTiling;
      public float DetailMaterialYTiling;
      public float DetailMaterialRotation;
      public bool DrawDetailMeshRenderer;
      public float DetailPlaneHeight;
      public bool DetailPlaneFollowTerrainCurve;
      public Vector3 DetailPlaneOffset;

      //Width for corner mesh where two planes with different angles meet
      public float CornerMeshWidth;

      private Vector3 OriginalStartPoint { get; set; }
      float currentX { get; set; }

      private bool coroutineRunning = false;

      //References to the terrain and prefab managers
      public TerrainManager TerrainManager { get; set; }
      public PrefabManager PrefabManager { get; set; }

      void Awake()
      {
      Setup();
      }

      public void Setup()
      {
      if (Rules != null)
      {
      Settings s = new Settings();
      s.Rules = Rules;
      s.PrefabRules = PrefabRules;

      s.MainMaterial = MainMaterial;
      s.MainMaterialXTiling = MainMaterialXTiling;
      s.MainMaterialYTiling = MainMaterialYTiling;
      s.MainMaterialRotation = MainMaterialRotation;

      s.TopMaterial = TopMaterial;
      s.TopMaterialXTiling = TopMaterialXTiling;
      s.TopMaterialYTiling = TopMaterialYTiling;
      s.TopMaterialRotation = TopMaterialRotation;
      s.DrawTopMeshCollider = DrawTopMeshCollider;
      s.DrawTopMeshRenderer = DrawTopMeshRenderer;

      s.DetailMaterial = DetailMaterial;
      s.DetailMaterialXTiling = DetailMaterialXTiling;
      s.DetailMaterialYTiling = DetailMaterialYTiling;
      s.DetailMaterialRotation = DetailMaterialRotation;
      s.DrawDetailMeshRenderer = DrawDetailMeshRenderer;

      s.MainPlaneHeight = MainPlaneHeight;
      s.TopPlaneHeight = TopPlaneHeight;
      s.DetailPlaneHeight = DetailPlaneHeight;

      s.CornerMeshWidth = CornerMeshWidth;

      s.OriginalStartPoint = this.transform.position;
      s.DetailPlaneOffset = new Vector3(0,.1f,-.2f);

      s.MainPlaneFollowTerrainCurve = MainPlaneFollowTerrainCurve;
      s.DetailPlaneFollowTerrainCurve = DetailPlaneFollowTerrainCurve;

      s.ParentGameObjectName = this.name;
      s.terrainDisplayer = this;

      TerrainManager = new TerrainManager(s);
      PrefabManager = new PrefabManager(s);

      Cleanup();
      }
      }

      //Remove the terrain and prefab managers and reset what we need to for the rules. This is called when we switch between edit and play modes
      public void Cleanup()
      {
      if (TerrainManager != null)
      {
      TerrainManager.RemoveTerrainObject();
      }
      if (PrefabManager != null)
      {
      PrefabManager.RemovePrefabObject();
      }

      for (int i = 0; i < PrefabRules.Count; i++)
      {
      PrefabRules[i].CurrentLocation = Vector3.zero;
      PrefabRules[i].LastPrefabLocation = Vector3.zero;
      }
      }

      // Use this for initialization
      void Start()
      {
      //Generate the initial terrain to avoid slowdown once we start
      Shader.WarmupAllShaders();
      }

      // Update is called once per frame
      void Update()
      {
      if (!coroutineRunning)
      {
      StartCoroutine(GenerateTerrainCoroutine(100));
      }
      }

      private IEnumerator GenerateTerrainCoroutine(float leadAmount)
      {
      coroutineRunning = true;

      GenerateTerrain(leadAmount);

      //No need to run this every frame...just run it every so often
      yield return new WaitForSeconds(.2f);

      coroutineRunning = false;
      }

      public void GenerateTerrain(float leadAmount)
      {
      //Track the right and left sides of the screen so we know how much terrain to generate
      Vector3 rightSide = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, -Camera.main.transform.position.z));
      Vector3 leftSide = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, -Camera.main.transform.position.z));
      float endX = rightSide.x + leadAmount;

      while (TerrainManager.VertexGen.CurrentTerrainRule != null && TerrainManager.GetFarthestX() < endX)
      {
      TerrainManager.Generate(endX);
      //Update our prefabs with the current terrain info
      PrefabManager.PlacePrefabs(TerrainManager);

      TerrainManager.Cleanup(leftSide.x - leadAmount);
      PrefabManager.Cleanup(leftSide.x - leadAmount);
      }

      //Only need this when we are no longer generating any new terrain but still need to do the final object cleanup
      if (TerrainManager.VertexGen.CurrentTerrainRule == null && TerrainManager.Pool != null && TerrainManager.Pool.TerrainPieces.Count > 0)
      {
      TerrainManager.Cleanup(leftSide.x);
      PrefabManager.Cleanup(leftSide.x);
      }
      }
      }






      c# unity3d






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 13 mins ago









      WokerHead

      12016




      12016



























          active

          oldest

          votes











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "196"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f209796%2funity-convert-3d-mesh-level-generator-code-to-2d-sprite-level-generator%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Code Review Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcodereview.stackexchange.com%2fquestions%2f209796%2funity-convert-3d-mesh-level-generator-code-to-2d-sprite-level-generator%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Ellipse (mathématiques)

          Quarter-circle Tiles

          Mont Emei