Code design / GameObject problem

Hello everyone,
I have this game design / game object issue. I will sum up the logical structure of my game and next present the problem itself.
In the game there are several classes, two of which are Cube and CubeGenerator. CubeGenerator is attached to empty CubeGenerator gameobject and responsible for generating cubes on the playground given methods specified within the class. When the moment to generate a cube comes up, the following code is being run:

cube[cubeNo] = gameObject.AddComponent("Cube") as Cube;
cube[cubeNo].Init (new Vector3(checkX, checkY+0.5f, checkZ),new Vector3(checkX, checkY, checkZ), AssignTower(), AssignOwner ());

Which in essence creates multiple identical Cube components on CubeGenerator GO. Init() method is my personal override for inability to call constructors - it assigns default values and performs initial checks, AND calls another metod which is responsible for instantiating actual cubes. What I want to achieve is to have Cube class OVER a GameObject class - so that gameObject is like a “physical” being, inheriting what I want from the uber class.

The problem I have is once I instantiate cubes, I can’t (or don’t know how) to communicate from the level of GameObject to the Cube which created it (i.e. cube[CubeNo]).
I have tried rewriting the above code into this:

cubeGoArray[cubeNo] = new GameObject();
cubeGoArray[cubeNo].AddComponent("Cube");
cube[cubeNo] = cubeGoArray[cubeNo].GetComponent<Cube>() as Cube;

so that Cube class is added as a component to each cube GO, but still something is off. I can tell that by the fact that I have problem with events. Namely:

void OnCollisionEnter(Collision col)
	{
		if (col.gameObject.name.StartsWith ("projectile"))
		{
			Debug.Log ("uderzylo " + gameObject.name);
			Debug.Log ("sila " + strength);
			
			IncrementTimesHit();
			renderer.material.color = Color.blue;
			if (strength >0)
			{
				strength -= timesHit;
			}
		}
	}

doesn’t work = i.e. fields like “strength” are not being inherited somehow (although they work - since they are embedded in the name of GO, and I can tell that they are passed to GO from Cube class), but instructions which affect GO and not Cube work (like “renderer.material.color = Color.blue;”).

I want to have cube objects as instants of Cube class, which then are instantiated as cube GameObjects AND remember their structure and properties from Cube class (as assigned to them by CubeGenerator during creation and updated later on).
So, my final question is, how to rewrite the code to amend this?

Make a Cube class that does not inherit from MonoBehaviour and holds a reference to a cube GameObject that is instantiated as part of Cube’s constructor.

Thank you very much for reply, KelsoMRK. Is it the only way? I am asking because in the Cube class I use types like Vector3 or Color, which are very convenient. What I considered was reversing the hierarchy - making a Cube class just a component of each cube Instance, but this seems limiting and unnatural (if you consider objective perspective). Also, would such a reference suffice:

cube[cubeNo] = Instantiate (cubePrefab, pos, rot);

Once again, thank you for prompt reply. Good luck with Fractured State!

Also, in case I make a non-monobehaviour class which instantiates in constructor cube gameobjects, how should I handle communication between cube class objects and corresponding cube gameobjects? Should I add then a cube class as a component to each of cube gameobjects, or leave it attached to a dummy gameobject? How should I handle such a thing like collisions then? OnCollisionEnter must be in a script attached to a gameobject - if I make CubeCollisions.cs and attach it to a cube GameObject, how can I then pass information to a Cube (class which constructed the cube) object corresponding to the cube gameObject?

A class doesn’t need to inherit from MonoBehaviour to use other classes in the UnityEngine namespace (Vector3, Color, GameObject, etc etc).

What I’ve done in the past is create a “bridge” class that can pass events in the engine to the data class. It’s a bit of a pain, but it does work.

using UnityEngine;

namespace Kelso.UnityForum.Whatever
{
    public class Cube
    {
        public GameObject GameInstance { get; private set; }

        public Cube()
        {
            this.GameInstance = new GameObject("Cube");
            CubeBridge cb = this.GameInstance.AddComponent<CubeBridge>();
            cb.SetData(this);
        }

        public void ConsumeTriggerEvent(Collider other)
        {
            // I can still use UnityEngine stuff because I included it above the class def
            Debug.Log("I'm a Cube class that just got triggered!");
        }
    }
}
using UnityEngine;

namespace Kelso.UnityForum.Mono
{
        public class CubeBridge : MonoBehaviour
        {
            private Cube data;

            public void SetData(Cube data)
            {
                if (this.data == null)
                    this.data = data;
            }

            // then you can pass engine-level events back to your other class
            // here is an example
            public void OnTriggerEnter(Collider other)
            {
                this.data.ConsumeTriggerEvent(other);
            }
        }
}

Then if you wanted to maintain some collection of Cube objects in a list you could do something like this and it would automatically create the objects in the world.

public List<Cube> TheCubes = new List<Cube>();
TheCubes.Add(new Cube());