Dev Guide
WebsiteGitHubGitBook
  • 📝Dev Intro
    • Using GitHub
    • Using Unity
    • Licensing
    • File Naming & Organization
      • File Naming
      • File Organization
        • Object Type
  • 📡Networking
    • Introduction to Game Networking
    • FishNet Networking
      • Server
      • Client
      • Server RPC
      • ObserversRPC
      • Network Message
  • 🖊️Guidelines
    • The C# Style Guide
      • Nomenclature
        • Namespaces
        • Classes & Interfaces
        • Methods
        • Fields
        • Parameters
        • Delegates
        • Events
        • Misc
      • Declarations
        • One declaration per source file
        • General class structure
        • Access Level Modifiers
        • Spacing
        • Brace Style
        • Switch Statements
        • Language
        • Common Patterns and Structure
          • Applying attributes on all network related methods.
    • Code Design Definitions
      • Actor
      • System
      • View
      • Events
        • Event Bus
        • Action
      • System Locator
      • Tweening
    • Asset Criteria
      • External Criteria
        • Animations
        • Fonts
        • Models
        • Textures
        • Graphics
        • Audio
      • Importing Criteria
        • 3D Models
        • 3D Animations
        • Textures
        • Graphics
        • Audio
      • Internal Criteria
        • 3D Models
        • 3D Animations
        • Textures
        • Graphics
        • Audio
    • SS3D's coder good practices
    • Code design patterns
  • 📖Guides
    • Application Settings
    • Running the Project
      • Configure your firewall and antivirus
      • Building the game
      • Joining a server
      • Hosting a server
      • Setting up a dedicated server
    • Debugging SS3D
    • Maintainer Guide
      • Pull request review process
    • Testing SS3D
      • Assets audit tests
      • Edit mode tests
      • Play mode tests
        • Inventory test
        • Health tests
    • Working with animations
  • 🛣️Roadmap
    • Releases
Powered by GitBook
On this page

Was this helpful?

Edit on GitHub
Export as PDF
  1. Guidelines
  2. Code Design Definitions

Actor

PreviousCode Design DefinitionsNextSystem

Last updated 2 years ago

Was this helpful?

Actor is our substitute for MonoBehaviours, it optimizes and creates shortcuts for useful stuff.

Moving an object

Moving object with MonoBehaviours

transform.position = new Vector3(0, 0, 123);

Moving an object with Actor

Position = new Vector3(0, 0, 123);

The reason we do that is because transform.position goes into C++ every single time to get the transform, which can lead to performance issues later in development. Also it is a nice shortcut.

You can use the same idea for Rotation, and for getting the directions relative to that transform, like Forward, Up, Down.

Callbacks

The standard callback methods also have been changed, you'll use OnStart instead of Start, OnAwake instead of Awake, OnDestroyed instead of OnDestroy.

Another think you need to know is HandleUpdate, HandleLateUpdate and HandlePreUpdate. All these methods have one thing in common: they listen to an event bus to be called.

The reason being that in standard Unity environment, the engine searches through the entire instantiated object's list and tries to find the Update method declared somewhere. That's very slow.

Instead, our friend from the decided to create an event bus for the player loop timing, so Unity only needs to worry about one object with the Update method.

Every method that listens to the UpdateEvent event bus and its variants will then be called.

Networking

For networked objects, instead of NetworkBehaviour, you will use NetworkActor. They work the same way as Actor.

🖊️
CS Framework