cube bumping will make it black (with a video!)

Hi! it’s my first time with the unity Answers and as you will see, I’m kinda new to unity itself. I’m at the learning process of understanding the basic of this great software.

I have addressed earlier on unity answer what challenge I am facing and a gentleman helped me with this code

I’ve did it by addapting the variable name to mine and it gives this

static var Bipolair : String ;
var Black : Color ;
private var controller : CharacterController ;
 
function Start()

{
controller = GetComponent(CharacterController) ;
print (controller);
}
 
function OnControllerColliderHit( other:ControllerColliderHit)
{
	if(other.gameObject.CompareTag(Bipolair))
	{
		other.gameObject.renderer.material.color = Black ;
	}
}

but it doesnt work. I’ve made a video about it so it can be better for pointing out the problem that is, I am sure, very obvious for an advance unity user.

I recommand puting it full screen at 1080HD

thank you n_n

Bipolair is a static string that is never initialized. You’re checking for a tag of null, instead of whatever string you tagged the cube with.

I’m sure it make sense but I dont understand how to initialize it. I thought it would be initialize when a collision will happen… but how would I initialize it then?

More specifically, you never give Bipolair a value.