Skip to content

Instantly share code, notes, and snippets.

@andijakl
Created July 29, 2019 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andijakl/1294a8c6304b6f2b6cb7e95ee9f4a064 to your computer and use it in GitHub Desktop.
Save andijakl/1294a8c6304b6f2b6cb7e95ee9f4a064 to your computer and use it in GitHub Desktop.
Check if the user assigned an anchor entity through the Sumerian web editor. If not, use a self-reference to the entity that owns our script component.
// Check entity that will get the anchor component
// -------------------------------------------------------------------
// Allow providing a specific entity in Sumerian where
// the anchor should be located in the scene hierarchy.
if (!this.anchorEntity) {
// Fallback: if the developer didn't set an entity in the editor,
// use this object (self).
console.log("no anchor entity provided - use self");
this.anchorEntity = ctx.entity;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment