Closed skelar32 closed 8 years ago
You do not need to use LogicComponent
as a base class like you do in C++.
Instead, you use the UserComponent
class.
For some reason I can't use this UserComponent class, it says it couldn't be found, and I don't see it in project References/Urho (Only Component, LogicComponent, UnknownComponent).
@skelar32 actually it's just Component
.
You can override OnUpdate
and OnAttachedToNode
(Start).
For GetVar and GetVars - it's a known issue.
But Component doesn't have FixedUpdade (for moving Rigidbodies) and PostUpdate. Anyway, I worked around it, though I would prefer to have these methods in the first place
@skelar32
FixedUpdate: physicsWorld.PhysicsPreStep +=
PostUpdate: scene.ScenePostUpdate +=
Yeah, I kind of had it done like this, but in a messy way (what was I thinking..). Thanks for pointing it out and yes, Component class is enough.
Still, the main reason I submitted issue was because of GetVar. That's how you would get variables that you can set in Editor, right? I'm still new with Urho so I may just be missing something
@skelar32 the latest UrhoSharp package contains LogicComponent with all needed events.
I am closing this based on the last comment.
There are missing methods in Node.cs to get user variables like in Urho3D/Scene/Node.h Variant& GetVar(StringHash key) and VariantMap& GetVars(). In UrhoSharp can only set them, no way to retrieve them.
Also methods Start, FixedUpdate, FixedPostUpdate and PostUpdate in UrhoD/Scene/LogicComponent.h are virtual, whereas in LogicComponent.cs they are not and it's impossible to override them.