dick_1
February 28, 2017, 11:42pm
1
Hello, I opened a project and theres code that’s throwing the following errors:
Unexpected symbol “>” “<”
And here is the code snippet :
[DebuggerHidden]
private IEnumerator Start()
{
WorldBuilder.< Start > c__Iterator2 < Start > c__Iterator = new WorldBuilder.< Start > c__Iterator2();
< Start > c__Iterator.<> f__this = this;
return < Start > c__Iterator;
}
These are the libraries that I have included:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
Does anybody know why this is incorrect? Any help would be greatly appreciated!! Thank you!
Suddoha
February 28, 2017, 11:44pm
2
dick_1:
Hello, I opened a project and theres code that’s throwing the following errors:
Unexpected symbol “>” “<”
And here is the code snippet :
[DebuggerHidden]
private IEnumerator Start()
{
WorldBuilder.< Start > c__Iterator2 < Start > c__Iterator = new WorldBuilder.< Start > c__Iterator2();
< Start > c__Iterator.<> f__this = this;
return < Start > c__Iterator;
}
These are the libraries that I have included:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
Does anybody know why this is incorrect? Any help would be greatly appreciated!! Thank you!
Have you ever used C# before?
Where have you taken the code from?
No idea what you are trying to write, but all those < and > don’t make sense…
dick_1
February 28, 2017, 11:50pm
4
Yes, I use C# and Javascript(Unityscript)
I got the code from an example project, this is the only script giving me problems.
Here’s the entire script :
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
public class WorldBuilder : MonoBehaviour
{
[DebuggerHidden]
private IEnumerator Start()
{
WorldBuilder.<Start>c__Iterator2 <Start>c__Iterator = new WorldBuilder.<Start>c__Iterator2();
<Start>c__Iterator.<>f__this = this;
return <Start>c__Iterator;
}
[DebuggerHidden]
private IEnumerator BackgroundBuilding()
{
WorldBuilder.<BackgroundBuilding>c__Iterator3 <BackgroundBuilding>c__Iterator = new WorldBuilder.<BackgroundBuilding>c__Iterator3();
<BackgroundBuilding>c__Iterator.<>f__this = this;
return <BackgroundBuilding>c__Iterator;
}
private static Vector3i GetCurrentChunkPos()
{
Vector3i result = Vector3i.Round(Camera.main.transform.position).Div(Chunk.SIZE);
result.y = 0;
return result;
}
private void GetClosestUnbuiltColumns(Vector3i pos, Queue<ChunkPosition> columns)
{
columns.Clear();
for (int i = 0; i <= 2; i++)
{
for (int j = 0; j <= 2; j++)
{
Vector2 vector = new Vector2((float)j, (float)i);
if (vector.sqrMagnitude <= 2f)
{
ChunkPosition item = new ChunkPosition(pos.x + j, 0, pos.z + i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
item = new ChunkPosition(pos.x - j, 0, pos.z + i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
item = new ChunkPosition(pos.x + j, 0, pos.z - i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
item = new ChunkPosition(pos.x - j, 0, pos.z - i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
}
}
}
}
[DebuggerHidden]
private IEnumerator BackgroundBuildColumn(int x, int z)
{
WorldBuilder.<BackgroundBuildColumn>c__Iterator4 <BackgroundBuildColumn>c__Iterator = new WorldBuilder.<BackgroundBuildColumn>c__Iterator4();
<BackgroundBuildColumn>c__Iterator.x = x;
<BackgroundBuildColumn>c__Iterator.z = z;
<BackgroundBuildColumn>c__Iterator.<$>x = x;
<BackgroundBuildColumn>c__Iterator.<$>z = z;
<BackgroundBuildColumn>c__Iterator.<>f__this = this;
return <BackgroundBuildColumn>c__Iterator;
}
[DebuggerHidden]
private IEnumerator BackgroundBuildChunk(Chunk chunk)
{
WorldBuilder.<BackgroundBuildChunk>c__Iterator5 <BackgroundBuildChunk>c__Iterator = new WorldBuilder.<BackgroundBuildChunk>c__Iterator5();
<BackgroundBuildChunk>c__Iterator.chunk = chunk;
<BackgroundBuildChunk>c__Iterator.<$>chunk = chunk;
<BackgroundBuildChunk>c__Iterator.<>f__this = this;
return <BackgroundBuildChunk>c__Iterator;
}
private const int RADIUS = 2;
public bool runtime = true;
private readonly bool[,] chunks2d = new bool[32, 32];
private readonly Queue<ChunkPosition> columns = new Queue<ChunkPosition>();
private readonly ChunkMeshBuilder builder = new ChunkMeshBuilder();
}
Looks like poorly decompiled code to me.
dick_1
February 28, 2017, 11:53pm
6
Btw, this did come from Unity 4.6, do you think "<>"could be removed or replaced in any way? Or any new changes in Unity 5 ?
Suddoha
February 28, 2017, 11:55pm
7
dick_1:
Yes, I use C# and Javascript(Unityscript)
I got the code from an example project, this is the only script giving me problems.
Here’s the entire script :
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEngine;
// Token: 0x0200003D RID: 61
public class WorldBuilder : MonoBehaviour
{
// Token: 0x06000218 RID: 536 RVA: 0x0000873C File Offset: 0x0000693C
[DebuggerHidden]
private IEnumerator Start()
{
WorldBuilder.<Start>c__Iterator2 <Start>c__Iterator = new WorldBuilder.<Start>c__Iterator2();
<Start>c__Iterator.<>f__this = this;
return <Start>c__Iterator;
}
// Token: 0x06000219 RID: 537 RVA: 0x00008758 File Offset: 0x00006958
[DebuggerHidden]
private IEnumerator BackgroundBuilding()
{
WorldBuilder.<BackgroundBuilding>c__Iterator3 <BackgroundBuilding>c__Iterator = new WorldBuilder.<BackgroundBuilding>c__Iterator3();
<BackgroundBuilding>c__Iterator.<>f__this = this;
return <BackgroundBuilding>c__Iterator;
}
// Token: 0x0600021A RID: 538 RVA: 0x00008774 File Offset: 0x00006974
private static Vector3i GetCurrentChunkPos()
{
Vector3i result = Vector3i.Round(Camera.main.transform.position).Div(Chunk.SIZE);
result.y = 0;
return result;
}
// Token: 0x0600021B RID: 539 RVA: 0x000087AC File Offset: 0x000069AC
private void GetClosestUnbuiltColumns(Vector3i pos, Queue<ChunkPosition> columns)
{
columns.Clear();
for (int i = 0; i <= 2; i++)
{
for (int j = 0; j <= 2; j++)
{
Vector2 vector = new Vector2((float)j, (float)i);
if (vector.sqrMagnitude <= 2f)
{
ChunkPosition item = new ChunkPosition(pos.x + j, 0, pos.z + i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
item = new ChunkPosition(pos.x - j, 0, pos.z + i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
item = new ChunkPosition(pos.x + j, 0, pos.z - i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
item = new ChunkPosition(pos.x - j, 0, pos.z - i);
if (item.Check() && !this.chunks2d[(int)item.x, (int)item.z])
{
columns.Enqueue(item);
}
}
}
}
}
// Token: 0x0600021C RID: 540 RVA: 0x00008934 File Offset: 0x00006B34
[DebuggerHidden]
private IEnumerator BackgroundBuildColumn(int x, int z)
{
WorldBuilder.<BackgroundBuildColumn>c__Iterator4 <BackgroundBuildColumn>c__Iterator = new WorldBuilder.<BackgroundBuildColumn>c__Iterator4();
<BackgroundBuildColumn>c__Iterator.x = x;
<BackgroundBuildColumn>c__Iterator.z = z;
<BackgroundBuildColumn>c__Iterator.<$>x = x;
<BackgroundBuildColumn>c__Iterator.<$>z = z;
<BackgroundBuildColumn>c__Iterator.<>f__this = this;
return <BackgroundBuildColumn>c__Iterator;
}
// Token: 0x0600021D RID: 541 RVA: 0x0000896C File Offset: 0x00006B6C
[DebuggerHidden]
private IEnumerator BackgroundBuildChunk(Chunk chunk)
{
WorldBuilder.<BackgroundBuildChunk>c__Iterator5 <BackgroundBuildChunk>c__Iterator = new WorldBuilder.<BackgroundBuildChunk>c__Iterator5();
<BackgroundBuildChunk>c__Iterator.chunk = chunk;
<BackgroundBuildChunk>c__Iterator.<$>chunk = chunk;
<BackgroundBuildChunk>c__Iterator.<>f__this = this;
return <BackgroundBuildChunk>c__Iterator;
}
// Token: 0x0400011A RID: 282
private const int RADIUS = 2;
// Token: 0x0400011B RID: 283
public bool runtime = true;
// Token: 0x0400011C RID: 284
private readonly bool[,] chunks2d = new bool[32, 32];
// Token: 0x0400011D RID: 285
private readonly Queue<ChunkPosition> columns = new Queue<ChunkPosition>();
// Token: 0x0400011E RID: 286
private readonly ChunkMeshBuilder builder = new ChunkMeshBuilder();
}
It’s surely not an example project. Looks like it’s either a de-assembled .dll or project.
dick_1
February 28, 2017, 11:58pm
8
Should I trash it? It’s been here a while
Nope, the unity version doesn’t change that those little bits shouldn’t be there.
dick_1
March 1, 2017, 12:01am
10
What’s the best resolution? Change the code? Trash it? Im clueless
That’s your decision.
It’s code that has been taken from a decompiled assembly, or even a whole project. Probably something you shouldn’t use either way.
dick_1
March 1, 2017, 12:15am
12
Does that mean it’s encrypted?
Oh ok thank you, that’s just what i need ed to know! (:
No, that doesn’t mean it is or was encrypted.
Compiled C# code ends up being IL code, the Intermediate Language. You can reverse the whole process. One reason why this code often does not run out of the box is, that during the orignal compilation, code has been optimized, some parts have been generated and even some anonymous data types and such have been created.
I’m no expert on this though. You can find detailed information about it on the internet if you’re interested.