I've figured out how to make an object. It works just fine when I do this:
And I know it's working because the log returns a Script Warning: Accessed None if I run TestFunction2() before TestFunction1(). And if I run TestFunction1(), then TestFunction2(), then TheTestObject.TestFunction1() returns a "testing... testing..." in TestFunction2().
So I'm able to make an object inside my PlayerInput class. Now how do I make an object automatically when the game starts? I've been able to do things from event PostLogin() inside my FrameworkGame class, but events like that don't seem to do anything inside my PlayerInput class.
I also tried starting at the event PostLogin() in FrameworkGame, and from there calling MyUnrealGame01PlayerController.CreateTestObject(), but that doesn't work either.
Any advice?
Code:
class MyUnrealGame01PlayerInput extends PlayerInput within MyUnrealGame01PlayerController;
var TestObject TheTestObject;
var string TestData;
function CreateTestObject()
{
TheTestObject = new class'TestObject';
}
simulated exec function TestFunction1()
{
ClientMessage("Creating object");
CreateTestObject();
}
simulated exec function TestFunction2()
{
TestData = TheTestObject.TestFunction1();
ClientMessage("Object function test 1: "$TestData);
}
And I know it's working because the log returns a Script Warning: Accessed None if I run TestFunction2() before TestFunction1(). And if I run TestFunction1(), then TestFunction2(), then TheTestObject.TestFunction1() returns a "testing... testing..." in TestFunction2().
So I'm able to make an object inside my PlayerInput class. Now how do I make an object automatically when the game starts? I've been able to do things from event PostLogin() inside my FrameworkGame class, but events like that don't seem to do anything inside my PlayerInput class.
I also tried starting at the event PostLogin() in FrameworkGame, and from there calling MyUnrealGame01PlayerController.CreateTestObject(), but that doesn't work either.
Any advice?