Question about GetParameter.
Posted: Fri Apr 22, 2022 2:09 am
Hello Tony, so I'm trying to make a custom sequencer command to change my dialogue background Image, thats the script:
But it seems I'm using GetParameter() wrongly, what I thought is that I would use ChangeBackground(3) in the sequence space in my dialogue entry, so my index would be 3, but GetParameter can only take strings? How can I make it take ints so I can achieve my goal with this Custom Sequencer Command?
Thanks in advance, have a nice weekend Tony.
Code: Select all
using UnityEngine;
using System.Collections;
using PixelCrushers.DialogueSystem;
using UnityEngine.UI;
namespace PixelCrushers.DialogueSystem.SequencerCommands
{
public class SequencerCommandChangeBackground : SequencerCommand
{ // Rename to SequencerCommand<YourCommand>
public void Awake()
{
int index = GetParameter(0); // error CS0029: Cannot implicitly convert type 'string' to 'int'
Image background = GameObject.Find("Dialogue Background").GetComponent<Image>();
background.sprite = Resources.Load<Sprite>("Backgrounds/" + index.ToString());
Stop();
}
}
}
Thanks in advance, have a nice weekend Tony.