Weird Stretchy Problem on Instantiate > SetParent with Prefabs

https://answers.unity.com/questions/868484/why-is-instantiated-objects-scale-changing.html

Super weird stretchy problem when objects were made using Instantiate/SetParent. It turns out this is a change in unity 5.5 where a bool is needed with SetParent.

problem

1
instance.transform.SetParent(transform);

no problem

1
instance.transform.SetParent(transform, false);

Moving things to the player once they’ve stuck

Random.onUnitSphere doesn’t do what I want

This makes things crazy.

Physics.ClosestPoint seems to do what I want.

Now to only have it operate on things stuck to the player.

Added this to control attached toggle:

1
2
3
4
5
6
using System.Collections;
using UnityEngine;

public class ThingToggler : MonoBehaviour {
    public bool attached = false;
}

Now in PlayerController.DoPickup:

1
other.gameObject.GetComponent<ThingToggler>().attached = true;

Then in ThingCondenser:

1
2
3
if (!GetComponent<ThingToggler>().attached) {
    return;
}

Attached ThingCondenser and ThingToggler to all of the flower prefabs, and we’re in business.

More things

Microphones. Because.

Also, microphone bowling.