Skip to content

Instantly share code, notes, and snippets.

@boformer
Last active February 11, 2016 18:42
Show Gist options
  • Select an option

  • Save boformer/701514e1a07395a66cc1 to your computer and use it in GitHub Desktop.

Select an option

Save boformer/701514e1a07395a66cc1 to your computer and use it in GitHub Desktop.

Revisions

  1. boformer revised this gist Feb 11, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@
    {
    foreach (KeyValuePair<string, Texture2D> entry in currentPrefabProperties)
    {
    Texture2D texture2D = entry.Value as Texture2D;
    Texture2D texture2D = entry.Value;

    if(texture2D == null) continue; // null-Werte skippen

  2. boformer revised this gist Feb 11, 2016. 1 changed file with 3 additions and 6 deletions.
    9 changes: 3 additions & 6 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -3,20 +3,17 @@
    foreach (KeyValuePair<string, Texture2D> entry in currentPrefabProperties)
    {
    Texture2D texture2D = entry.Value as Texture2D;

    if(texture2D == null) continue; // null-Werte skippen

    RenderTexture temporary = RenderTexture.GetTemporary(texture2D.width, texture2D.height, 0);
    Graphics.Blit(texture2D, temporary);

    var filename = ModLoader.currentTexturesPath_default + temporary.name + ".dds";
    var filename = ModLoader.currentTexturesPath_default + texture2D.name + ".dds";

    if (File.Exists(filename))
    {
    currentPrefabProperties.Remove(entry.Key);
    currentPrefabProperties.Add(entry.Key, LoadTextureDDS(filename) as Texture2D);
    }

    RenderTexture.ReleaseTemporary(temporary);

    { }// do something with entry.Value or entry.Key
    }
    }
  3. @tommargar tommargar created this gist Feb 11, 2016.
    22 changes: 22 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    public static void GetTextureName()
    {
    foreach (KeyValuePair<string, Texture2D> entry in currentPrefabProperties)
    {
    Texture2D texture2D = entry.Value as Texture2D;

    RenderTexture temporary = RenderTexture.GetTemporary(texture2D.width, texture2D.height, 0);
    Graphics.Blit(texture2D, temporary);

    var filename = ModLoader.currentTexturesPath_default + temporary.name + ".dds";

    if (File.Exists(filename))
    {
    currentPrefabProperties.Remove(entry.Key);
    currentPrefabProperties.Add(entry.Key, LoadTextureDDS(filename) as Texture2D);
    }

    RenderTexture.ReleaseTemporary(temporary);

    { }// do something with entry.Value or entry.Key
    }
    }