2018.1 parenting bug.

Hello Unity devs!

Might be having an issue.
Which I am quite sure is a ‘bug’.

Because it worked up until now. (Been using 2018.1) sense release, no issues until now.

Alright so here’s what I’m doing.
I have an Editor Window that lets me mass spawn objects over my terrain. (Been working for past few days).
But now I’m getting an error about, “Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption”

Looked this error up, it appears it should only happen if you try to make the prefab onto a parent, not what I’m doing. I’m doing it with the object i spawned it as E.G. GameObject go (GameObject) Instantiate.

as said it’s worked past few days no issues until now.
Here’s the code, not much to show, but perhaps I did something that warrants this error now?

GameObject newObject = (GameObject)Instantiate(prefabsToSpawn, new Vector3(posx, posy, posz), Quaternion.Euler(0,Random.Range(0,360),0));
newObject.transform.SetParent(objectToParentWith);

You see, the error from research says that if I do prefabsToSpawn.transform.SetParent() I would get the error. But as you can tell, I’m doing it with newObject.transform.SetParent().

Also on this note:
I was getting two different results as well.

I have a Fern (plant) (which is when the error started and now never stops when I use the tool).
But anyways, If I spawn the fern plant with the tool. It just pops out empty objects (because I have LOD on it).
BUT, if I make the Fern and LOD’s a child of an empty, they spawn, just wont parent.

But like I said, I know the tool works, been using it for days.
It’s just now it’s deciding to act up for some reason.
Haven’t made any changes to it to warrant any errors randomly.

If you think it’s a bug, it’s probably best to submit a bug-report. This allows UT to repair their software and we don’t have to come up with workarounds.