I wanted to have a function that returns a copy of the object it receives, to use it somewhere else. This is what I wrote:
public static PObject Instantiate(PObject obj)
{
PObject other = obj;
objects.add(other);
return other;
}
But when I print obj + " " + other, it outputs:
PObjects.Wall@5315b42e
PObjects.Wall@5315b42e
How can I return the same object stored in a different variable?