Giter Club home page Giter Club logo

react-umg's Introduction

This repository is a fork of react-umg whose original author is Wolfgang Steiner

A React renderer for Unreal Motion Graphics (https://docs.unrealengine.com/latest/INT/Engine/UMG/)

This project is dependent on Unreal.js

We recommend using React with Babel to let you use JSX in your Javascript code. JSX is an extension to the Javascript language that works nicely with React.

Install

To install React-UMG with npm, run:

npm i --save react-umg

Web-dev like Component Naming

  • div(UVerticalBox)
  • span(UHorizontalBox)
  • text(UTextBlock)
  • img(UImage)
  • input(EditableText)

Example

Create Component

class MyComponent extends React.Component {
    constructor(props, context) {
        super(props, context);
        this.state = {text:"MyComponent"};
    }

    OnTextChanged(value) {
        this.setState({text: value});
    }

    render() {
        return (
            <div>
                <uEditableTextBox Text={this.state.text} OnTextChanged={value=> this.OnTextChanged(value)}/>
                <text Text={this.state.text}/>
            </div>
        )
    }
}

Draw With React-UMG

let widget = ReactUMG.wrap(<MyComponent/>);
widget.AddToViewport();
return () => {
    widget.RemoveFromViewport();
}

License

  • Licensed under the BSD 3-Clause "New" or "Revised" License
  • see LICENSE for details

react-umg's People

Contributors

crocuis avatar crocuis-nc avatar samirbr avatar synastry-nc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-umg's Issues

TypeError: Cannot read property 'Add' of undefined

I'm using Unreal.js zThirdPerson.js example. It runs perfect and smooth.
When I run the following code snipped from React-UMG documentation.

const React = require('react');
const ReactUMG = require('react-umg');

class MyComponent extends React.Component {
  constructor(props, context) {
    super(props, context);

    this.state = {
      text: 'MyComponent',
    };
  }

  OnTextChanged(value) {
    this.setState({
      text: value,
    });
  }

  static attach() {
    this.widget = ReactUMG.wrap(<MyComponent />);
    this.widget.AddToViewport();

    return () => {
      this.widget.RemoveFromViewport();
    };
  }

  render() {
    return (
      <div>
        <uEditableTextBox
          Text={this.state.text}
          OnTextChanged={value => this.OnTextChanged(value)} />
        <text Text={this.state.text} />
      </div>
    );
  }
}

MyComponent.attach();

I get the following error.

Error: Game/Content/Scripts/node_modules/react-umg/src/ReactUMGMount.js:146: TypeError: Cannot read property 'Add' of undefined
Error: TypeError: Cannot read property 'Add' of undefined
Error:     at Object.render (Game/Content/Scripts/node_modules/react-umg/src/ReactUMGMount.js:146:26)
Error:     at Function.attach (Game/Content/Scripts/components/MyComponent.js:36:38)

I pushed a PR to fix this error.

Thanks

How to debug this stuff?

Hi guys, I am exited to see react integration for unreal4. I want to help with development. How do you debug this stuff?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.