Hi guys.So im trying to acces a script form a newly created object.I am creating the player Object at startup and i want enemy object to acces the script from the player object.
I was not quite sure how to do this so in the inspector i just put the player prefab.
Doing this gave me no errors but the character is not reciving Exp either.
This is the code i have on the enemy script:
WarriorObj here is the player prefab but it is not working as i want it too:
PlayerStats StatsScript = WarriorObj.GetComponent<PlayerStats>();
StatsScript.Exp += 20;