Trying to Invoke method: Character_ControllerXD.SuperSpeedJump couldn't be called.
Hi!, i've been having this problem the last days when using the invoke method... Here's the code i'm using public class PickAbleObject : MonoBehaviour { public enum TypeOfPower { SuperSpeedPower, SuperJumpPower, FireBottlePower, SuperdashPower, GrapplerGun, ShootFireBallPower};
public TypeOfPower Power;
private string VoidName;
public float DefaultTimeOfUse = 15f;
public float Radius = 1;
public GameObject GetEffect, PlayerGetEffect;
private bool HaveTouchedPlayer;
public LayerMask PlayerLayerMask;
Transform Player;
private void Start()
{
Player = GameObject.Find("Player").transform;
}
void Update()
{
switch (Power)
{
case TypeOfPower.SuperJumpPower:
VoidName = "SuperJump";
break;
case TypeOfPower.FireBottlePower:
break;
case TypeOfPower.GrapplerGun:
VoidName = "GetGrapplerGun";
break;
case TypeOfPower.SuperdashPower:
VoidName = "SuperDashPowerXD";
break;
case TypeOfPower.SuperSpeedPower:
VoidName = "SuperSpeed";
break;
}
AssingYourPower();
}
void AssingYourPower()
{
bool TouchedPlayer = Physics2D.OverlapCircle(transform.position, Radius, PlayerLayerMask);
if(TouchedPlayer)
{
Character_ControllerXD CC = Player.GetComponent<Character_ControllerXD>();
CC.Invoke(VoidName, 0.0f);
gameObject.SetActive(false);
}
}
}
what i'm wanting to do is depending of the type of power (which is selected on the inspector) set the name of the void which will be called, i'm trying to invoke different void through other code, idk if that's the problem, hope y'all can help me... thank u
Your answer
Follow this Question
Related Questions
How to Fade a Sprite after time has passed since it stops moving 1 Answer
slider controlling in unity 3d game,About Sound Slider Control 0 Answers
How can i make my boomerang work in Unity2d? 0 Answers
Why UI isn't instantiate when I create a new object that has Canvas as a child component? 0 Answers