Use Player name in dialouge?
Posted: Thu Oct 12, 2023 7:59 pm
Hi!
I have a simple script where I can name my player "Rune" for example, this is saved in my PlayerData sriptable object.
Can I somehow fetch the name of my player and show it in my dialogue?
Instead of the NPC saying " Hello there man, what's up?"
He can say "Hello there Rune, what's up?"
So, goes without saying, other players will have other names and their names will be shown in the Dialouge instead of Rune.
Thanks!
I have a simple script where I can name my player "Rune" for example, this is saved in my PlayerData sriptable object.
Can I somehow fetch the name of my player and show it in my dialogue?
Instead of the NPC saying " Hello there man, what's up?"
He can say "Hello there Rune, what's up?"
So, goes without saying, other players will have other names and their names will be shown in the Dialouge instead of Rune.
Code: Select all
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(menuName = "Data/Player Data")]
public class PlayerData : ScriptableObject
{
public string characterName; //Can I fetch this somehow?
public Gender playerCharacterGender;
public int saveSlotId;
}