Skip to content

Creation of properties from managed code #61

@OlsonDev

Description

@OlsonDev

I have a class deriving from Actor, with a constructor that looks like:

public class Card : Actor {
    public Card(string name = null) : base(name) {
      // Set up mesh, material, register events
      AddTag("MyTag");
      SetInt("MeaningOfLife", 42);
      var meaningOfLife = 9001;
      var gotIt = GetInt("MeaningOfLife", ref meaningOfLife);
      Debug.AddOnScreenMessage(1, 3.0f, Color.Red, $"Meaning of life: {gotIt}; {meaningOfLife}");
    }
}

When I play in the editor, it outputs False; 9001 when I'd expect True; 42.

I've played around and moved the GetInt and SetInt calls all over, thinking perhaps it was an object lifetime issue, but I can't seem to get this to ever print out my expectations. Currently I'm instantiating a Card in OnWorldPostBegin(). I've also tried GetBool and SetBool and those didn't work either -- I'm guessing this is broken for all of the method pairs.

The AddTag() call seems to work -- I can see it when I inspect the Details pane with the Card actor selected.

Is this a bug or am I doing something wrong?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions