Skip to content

Commit 68ed0c6

Browse files
author
Philipp Molitor
authored
Merge pull request #12 from PhilippMolitor/dev
release 2020.0.3
2 parents a0054e5 + 7c0423e commit 68ed0c6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-unity-renderer",
3-
"version": "2020.0.2",
3+
"version": "2020.0.3",
44
"description": "React Unity Renderer allows to interactively embed Unity WebGL builds into a React powered project.",
55
"main": "./dist/index.js",
66
"types": "./dist/index.d.ts",

src/components/UnityRenderer.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,11 @@ export const UnityRenderer: VFC<UnityRendererProps> = ({
135135

136136
// on context change
137137
useEffect(() => {
138+
// remove (previous) context if any
139+
if (!context || context !== ctx) unmount();
140+
141+
// set new context
138142
if (context) setCtx(context);
139-
else unmount();
140143
}, [context]);
141144

142145
// on mount

0 commit comments

Comments
 (0)