MFPS - Mobile Control Error

General support.
Post Reply
User avatar
ToprakBaskan
New Member
New Member
Posts: 2
Joined: Mon Dec 06, 2021 11:07 am

I was developing my game for mobile, but when I activated the Mobile Controller, too many errors occurred. I fixed most of them, but I couldn't fix this one.

Code: Select all

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class bl_WeaponMobileSwitcher : MonoBehaviour
{
    [SerializeField] private Image PreviewImage;

    private bl_GunManager GunManager;
    private bl_GameManager Manager;
    private bl_GameData Data;

    private void Awake()
    {
        Manager = FindObjectOfType<bl_GameManager>();
        Data = bl_GameData.Instance;
    }


    private void OnEnable()
    {
        bl_EventHandler.OnLocalPlayerSpawn += OnLocalSpawn;
    }


    private OnDisable()
    {
        bl_EventHandler.OnLocalPlayerSpawn -= OnLocalSpawn;
    }

    void OnLocalSpawn()
    {
        GunManager = Manager.OurPlayer.GetComponentInChildren<bl_GunManager>();
        Invoke("TakeFirst", 1);
    }

    public void ChangeWeapon(bool forwa)
    {
        if (GunManager == null)
            return;

        int c = 0;
        if (forwa)
        {
            c = GunManager.SwitchNext();
        }
        else
        {
            c = GunManager.SwitchPrevious();
        }
        PreviewImage.sprite = Data.GetWeapon(GunManager.PlayerEquip[c].GunID).GunIcon;
    }

    private void TakeFirst() => PreviewImage.sprite = Data.GetWeapon(GunManager.CurrentGun.GunID).GunIcon;
}

Error Code: bl_WeaponMobileSwitcher.cs(27,13): error CS1520: Method must have a return type
User avatar
Lovatto
Admin
Admin
Posts: 1834
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

If you get errors after importing the mobile addon, it means you are using an incompatible version of the addon with your MFPS version,
the code of the script that you posted is not from the last version of the addon, so I'll recommend to update it.
How to find your Invoice Number: Here
How to find your Order Number: Here
Post Reply