• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

GetActivationText

Boogman

New member
Is this how you change the text the player sees when he looks at a block.

I tried it but got an error: Format Exception: Input string not in a correct format.

Code:
using System;
using UnityEngine;

public class BlockmyElevator : Block
{

   public override string GetActivationText(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos,
       EntityAlive _entityFocusing)
   {
       return "Press <{E}> to operate the Elevator";
   }

}
 
Is this how you change the text the player sees when he looks at a block.
I tried it but got an error: Format Exception: Input string not in a correct format.

Code:
using System;
using UnityEngine;

public class BlockmyElevator : Block
{

   public override string GetActivationText(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos,
       EntityAlive _entityFocusing)
   {
       return "Press <{E}> to operate the Elevator";
   }

}
It's the { } that it's upset about. You can use that if you are using the localization and the string.Format() command.

But since you are just returning a string, you don't need to use them.

Code:
return "Press <E> to operate the Elevator";
 
Wow, I didn't think it would matter, they were inside the quotes.

It's working now...!

Thank you...!

 
Last edited by a moderator:
Back
Top