PLEASE THIS IS VERY URGENT!!!
I have two scripts. One is on the player and the other is on another object. Lets call that object ‘a’. I have a function in my player that increases the scale and this is how it goes:
public void increasePlayerSize(float factor)
{
currentScale = gameObject.transform.localScale;
gameObject.transform.localScale += new Vector3(factor, factor, factor);
}
‘a’ has an onTrigger script that triggers this function whenever an object with the tag player collides with it
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Player")
{
player.increasePlayerSize(increaseSizeFactor);
logic.level++;
gameObject.SetActive(false);
}
}
But this is not working and i dont know why.
I had another version of this where the triggering and scaling happened on the Player itself.
public void increasePlayerSize(float factor)
{
currentScale = gameObject.transform.localScale;
gameObject.transform.localScale += new Vector3(factor, factor, factor);
}
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Upgrade")
{
increasePlayerSize(factor);
logic.level++;
}
}
This was working but i wanted to move the UPGRADE part to its own separate script because UPGRADE is another game object and i dont want it interfering with player scripts