hi there im having a rought time with this code, trying to make a gameobject grow in scale from touching this one, and when a set amount of scale is reached destroy this game object ( the one who scales up the other), but my problem so far is that when i access the playerscript scale it dosnt add any scale to the gameobject.
using UnityEngine;
using System.Collections;
public class ScaleUp : MonoBehaviour {
public GameObject Player;
public PlayerMovement PlayerScript;
private float playerScaleX;
private float playerScaleY;
public float scaleUp = 10.0f;
void Start()
{
Player = GameObject.FindGameObjectWithTag ("Player");
PlayerScript = Player.GetComponent <PlayerMovement>();
playerScaleX = Player.transform.localScale.x;
playerScaleY = Player.transform.localScale.y;
}
void Update ()
{
}
void OnTriggerEnter2D (Collider2D other)
{
if (other.tag == "Player")
{
playerScaleX += scaleUp;
playerScaleY += scaleUp;
Debug.Log ("GROW");
}
}
}