I'm trying to make a GameObject
grow in scale from touching this one, and when a set amount of scale is reached destroy this GameObject
( the one who scales up the other). My problem so far is that when I access the playerscript scale it dosn't 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");
}
}
}