help with constructing a fractal

first of all i dont really know what a fractal is … and im getting an error at line 20 , i dont know what to do. if your wondering what tutorial im following its from ‘catlikecoding.com

The turorial does this:

new GameObject("Fractal Child").AddComponent<Fractal>().Initialize(this);

Which is a bit unclear. This is what it’s doing:

//Create a GameObject named Fractal Child
GameObject fractalChild = new GameObject("Fractal Child");

//Add a Fractal Component to the GameObject we just made
Fractal fractal = fractalChild.AddComponent<Fractal>();

//Call Initialize() on the Component we just added.
fractal.Initialize(this);

While you’re doing this:

new GameObject("Fractal Child").AddComponent<Fractal>();
AddComponent.<Fractal>.Initialize(this);

“AddComponent..Initialize(this)” is not valid code. It should be AddComponent().Initialize(this). And MonoBehaviour does not have a method named AddComponent. You have to use GameObject.AddComponent if you want to add a component to a GameObject.

1 Like

thank you.

Is a figure made out of a pattern that repeats itself infinitely at any scale, whenever you zoom-in or zoom-out.

1 Like

thank you