Created
July 29, 2019 16:00
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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